“Load all HTML, then load all JS, then hydrate a complete tree” is such a waterfall. Keep an eye on approaches that let you split it apart and hydrate UI progressively! Concurrent Mode is our vision for how it could work, but I’d love to see other libraries exploring this too.
-
-
Prikaži ovu nit
-
This is an example of why “Concurrent Mode is only needed in React due to reconciliation overhead” is such an unfortunate misunderstanding. Concurrent Mode lets React do work “on the side”. This unlocks many abilities that weren’t possible! Time slicing is just a nice bonus.
Prikaži ovu nit -
Here is a demo of “event replaying”. Note how the clicks we did earlier take effect after the code loads. (Thanks
@Winwardo for reminding me to show this and pointing out a bug in my original code.)pic.twitter.com/dyWquijLK4Prikaži ovu nit -
It’s not that difficult to implement something naïve like this. But what about corner cases? That’s where it gets interesting. Here, I click A, B — but load B, A. React knows replaying B click is unsafe until A loads because A’s click could have influenced some shared state.pic.twitter.com/jZA9T9FAOT
Prikaži ovu nit
Kraj razgovora
Novi razgovor -
-
-
Anyone who's confused why the non-hydrated version only seems to register a max of 1 click, change line 66 to onClick={() => setCount(count => count + 1)}
-
The fact this "fixes" the suggests that despite not hydrating, we're still capturing events to relay to the hydration later? Or is that simply an artifact of the demo? (aforementioned bugs)
- Još 8 drugih odgovora
Novi razgovor -
-
-
Very cool! does this absolutely require concurrent mode? was thinking a separate bundle for each component and calling hydrate() twice would do something similar.
-
Yeah this requires Concurrent Mode. You can do something hacky in userland but there are many things that would break at scale (outside of two components). Semantics of event replaying, what happens if props change, etc.
- Još 2 druga odgovora
Novi razgovor -
-
-
This is so
I’m wondering, is @gatsbyjs using the same kind of « progressive hydration » or it it all or nothing? - Još 3 druga odgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.