Using $effect
to update derived state inside the component
#15344
Replies: 2 comments 4 replies
-
I too have encountered this issue. @wjfe/dataview, up to v0.12.0, ran entirely on a single The consequence: Now the component doesn't render server-side because It seems that we will have to wait for #14784 to be able to use a potential new |
Beta Was this translation helpful? Give feedback.
-
Thanks for responding @webJose!
Great to know, thanks! I've seen some cases where
Then accessed in the template via |
Beta Was this translation helpful? Give feedback.
-
I have run into cases where some local state needs to be updated when a prop changes (so is derived) but also needs to be updated inside the component:
Am I using
$effect
the wrong way here? If so, what should I be using? I know I could also acceptisExpanded
as a prop and have the consumer set bothisExpandable
andisExpanded
as needed, but I want to avoid having to duplicate that code wherever the component is used.I've seen discussions where great lengths are travelled to discourage
$effect
so I generally try to avoid it. But what I don't understand exactly is what's wrong with using it? What downsides should I be aware of?Beta Was this translation helpful? Give feedback.
All reactions