I'll be writing an explanation of what's going on and why it's significant/what practical learnings we can gain from this. ... I'm still evaluating it myself...
-
Show this thread
-
Replying to @kentcdodds
This is really weird. Like... I understand what's happening on an intuitive level, but I couldn't explain it if you put a gun to my head. Definitely looking forward to your explanation
1 reply 0 retweets 2 likes -
Replying to @rossipedia @kentcdodds
TL;DR: it's because App2's children object doesn't change, right?
2 replies 0 retweets 1 like -
Replying to @rossipedia @kentcdodds
Dan Abramov Retweeted Sebastian Markbåge
Yes, and that (rather than memo'ing everything) can be a nice way to optimize updates.https://twitter.com/sebmarkbage/status/1096115287781400576 …
Dan Abramov added,
1 reply 1 retweet 26 likes -
Replying to @dan_abramov @rossipedia
Uhhhh, sure wish I hadn't missed that tweet
Makes so much sense now, but I've never noticed this until now
4 replies 1 retweet 10 likes -
Replying to @kentcdodds @dan_abramov
Just to clarify, when he says "children can't have changed", how exactly does react know that without static analysis? Is it because `children` doesn't appear in any hook dependency lists?
1 reply 0 retweets 0 likes -
Replying to @rossipedia @kentcdodds
No, it's literally prevProps.children !== nextProps.children.
2 replies 0 retweets 7 likes -
(This also isn't a new thing; React worked this way for as long as I can remember. If this wasn't the case, you couldn't have "wrapper" component close to the root set state without triggering updates for everything below)
2 replies 0 retweets 5 likes -
(literally forever). The hoisting part to make this work for online elements was a big part of why prepack started. There was even a Babel plugin before that which kinda worked (but iirc was buggy enough that we didn't recommend it)
2 replies 0 retweets 2 likes -
Babel thing also shifted work to be eager which isn't ideal. Ideally it'd be lazy first time it's rendered.
1 reply 0 retweets 1 like
Are we referring to the constant elements transform? It just hoisted the React.createElement calls. Wouldn’t they just be creating the element objects eagerly? What other work would it be doing?
-
-
Replying to @sebmck @dan_abramov and
Yea. Not so much buggy but I think surprised people. Moving to module level resulted in more start-up costs even if a component wasn't rendered. I'm guessing the ideal state might be closer to memoized after first use.
1 reply 0 retweets 3 likes -
Maybe there’s a better case for hoisting now that we have React.lazy?
0 replies 0 retweets 1 like
End of conversation
New conversation -
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.
he/him 