SolidJSS
SolidJSโ€ข3y agoโ€ข
2 replies
Osman

createStore not reactive

I have the following code:
    function handleInput(event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element}) {
        const input = event.currentTarget.id;
        
        setQuestions(questionID, 'answer', input)        
        console.log(questions[questionID].answer);
    }

    createEffect(() => {
        console.log(questions[questionID].answer);
        
    })

    function isChecked(answerOption: string, answer: string) {
        console.log(questions[questionID].answer);

        return answer[0] === answerOption
    }


When updating the questions[questionID].answer in handleInput, it does not trigger the createEffect nor the isChecked function. isChecked is used as a flag function for a classList attribute
Was this page helpful?