Osman
Osman
SSolidJS
Created by Osman on 10/25/2023 in #support
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
}
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
3 replies
SSolidJS
Created by Osman on 10/24/2023 in #support
Mutable routeData
Hello, im fetching data from a server using routeData() and createRouteData() in solid-start. What's the best way to mutate this data? Is this possible/intended? For now my idea is to move the fetched data into a context store, but it would be easier to just mutate the fetched data objects directly.
1 replies