Replies: 2 comments
-
|
like this ? it is work in solid |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This is because in line 5, you do only evaluate props.value once. There is no reactive relation between val and props.value. The difference between React and Solid is that in React, effects, memos and state are escape hatches from component code re-running again and again, whereas in Solid, they are doors into reactivity, while components run only once. That also means that if you read from a prop outside of a JSX attribute, an effect or a memo, it will not register its reactivity. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an example playground here: https://playground.solidjs.com/anonymous/61105e7e-bb63-420d-ad64-a1090a588b6c
Here is the code for those interested:
I was thinking about how in React if a prop value changes, then you have to use React.useEffect to react to those changes to then update the value inside of the useState that accepts that prop. Is that the same case for Solid? I thought that you could reference a reactive prop inside a createSignal and it would update accordingly but it doesn't appear to work that way. When value changes to "Adam" the child value does not update
Beta Was this translation helpful? Give feedback.
All reactions