Am I missing something simple? How do I
Am I missing something simple? How do I get a button whose value changes when the button is clicked
why doesn't this work?
8 Replies
hhmmm @MaartenBreddels @iisakkirotko it only works if i do
sl.use_reactive
-- why is that?I think I ran into something similar. I think it has to do with how context is being handled.
Maybe related:
https://discord.com/channels/1106593685241614489/1106593686223069309/1235916338086543380
What if you modified to do this?
same thing weirdly.. BUT it does work if I define the reactive outside of hte component
so
*
sl.reactive
inside component: does not work
* sl.reactive
outside the component: works
* sl.use_reactive
inside the component: workseach rerender is likely redefining the global reactive, so it sets it to true each time
Where are you defining the reactive variable?
solara.reactive
should only be used at global context, within components you should use solara.use_reactive
instead.I think this would be a good example to add to the documentation, as it's not clear that this would happen
Yeah, I think this is another thing in the docs that is mentioned kind of off-hand. Maybe we could write a more in-depth piece on our reactivity system? We'll see in the new year :)