Freezing of props passed to connected children
See original GitHub issuepreact: ^10.0.0-beta.1
storeon: ^0.8.3
Hi!
If I pass some props from the parent component to the connected (by the connect()
function) child component, the props will be frozen there. Is it correct behavior?
You can see the example (https://codesandbox.io/s/exciting-nash-x8ur0?fontsize=14): checkbox updates a prop value
in the Child
component and doesn’t do it in the ChildConnected
component.
And thank you for the lib! 🙂
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Problems with props passed to child component
I am having trouble passing props to a child component in my app. When I navigate to any subject link that which has...
Read more >How to use Props in React - Robin Wieruch
As said, there is no way passing props from a child to a parent component. But you can always pass functions from parent...
Read more >Why Kids Freeze Up During Homeschool Lesson - Shiller Math
One of the most common reasons kids freeze up or don't engage, is overwhelm. Even if it's a lesson you've gone over before....
Read more >Ideas for Musical Games | Music Together
Try a game of “freeze dance”. Enjoy a game of "Freeze Dance" with one of the songs from your collection. · Play musical...
Read more >Backstage Pass campers are busy designing and creating sets ...
Backstage Pass campers are busy designing and creating sets, costumes, props, staging and more for the Stars on Stage performance of Frozen this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure.
The first render (you open the page). The prop
value
, passed from parent componentApp
, ison
. Toconnect()
function it comes withoriginProps
and then mixed withprops
are coming fromuseSoreon()
(line 10):Updating the prop
value
in the parent componentApp
caused rerender child components, and to the functionconnect()
nowvalue
is coming asoff
(originProps = { value: 'off' }
). But theprops
came fromuseSoreon()
contains the previous valuevalue = 'on'
and mixing withoriginProps
(line 12) rewrite old valueon
:So the children component wrapped with the function
connect()
will never update props, passed from parent.Now it perfectly works (https://codesandbox.io/s/exciting-nash-x8ur0?fontsize=14).
@hadeeb and @ai thank you for your work!