2/2: component subtree. Make sure all the children components are also 'pure'"
-
-
Let me try to explain it.. the important part is *who* calls setState.
2 replies 0 retweets 1 like -
Replying to @dan_abramov @wycats and
Let's forget about Flux for a minute and look at vanilla React. If you call setState at the top, anything below might need a redraw.
1 reply 0 retweets 0 likes -
Replying to @dan_abramov @wycats and
Because setState can change props passed to children, which can change props of their children etc.
1 reply 0 retweets 0 likes -
Replying to @dan_abramov @wycats and
This is the case docs are talking about. sCU in any child can break the chain *started due to the (grand)parent update*.
2 replies 0 retweets 0 likes -
Replying to @dan_abramov @wycats and
With Flux/Redux there's not one update, but many. One for each connected component. So it's many setState()s at different depths.
2 replies 1 retweet 4 likes -
Replying to @dan_abramov @wycats and
sCU can only short circuit *React's* top down walk. It can't prevent Redux from telling a grandchild personally that it needs change.
1 reply 0 retweets 1 like -
So when your top-level reducer returns a new atom, Redux walks the entire object and calls setState on components? Surprised if so.
1 reply 0 retweets 0 likes -
Technically Redux just calls a list of callback listeners. It's like an emitter with one event.
2 replies 1 retweet 7 likes -
Replying to @dan_abramov @wycats and
React Redux bindings call setState for every component whose "slice of state" it's "selecting" has changed shallowly.
1 reply 1 retweet 5 likes
Can you show me an example of code doing this?
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.