S
SolidJS•14mo ago
lili/lilith

Component does not rerender when the state changes

I have attached the render logic in the attached file, the only relevant missing part is this from the top of the component
const [currentPopup, setPopup] = createSignal(null)
const [currentPopup, setPopup] = createSignal(null)
for some reason the console.log statement inside doRender is only called once and never after setPopup is called, even though I confirmed that the value is getting set inside the click listener. Please help ;.;
6 Replies
REEEEE
REEEEE•14mo ago
Components do not rerun in Solid. Thus early returns would not work either.
lili/lilith
lili/lilithOP•14mo ago
what can I do to make it so that it renders a popup instead of the main component content conditionally upon that signal changing? Also I thought it could "rerun" if it was wrapped in a closure (like im doing here)
REEEEE
REEEEE•14mo ago
Are you doing return doRender() in a component? Maybe try wrapping it in a fragment/div to see if that works
lili/lilith
lili/lilithOP•14mo ago
yes thats what I'm doing Ill try wrapping it in a fragment Hooray wrapping it in a fragment worked 🙂
REEEEE
REEEEE•14mo ago
nice Yeah, you can do it your way but it has to be inside JSX, if you just do return doRender() it will only run once and won't react to changes to the signal
lili/lilith
lili/lilithOP•14mo ago
Thank you!
Want results from more Discord servers?
Add your server