Understanding React "Suspense" API with a "simple" example.
medium.com/@baphemot/understanding-react-susp...Posted Mar 7, 2018, 6:48 AM UTC
Posted Mar 7, 2018, 6:48 AM UTC
When this is the "simple example", it means the API will still be kinda complicated for beginners to understand, hehe :P
This is not a beginner-ready API, it's a completely unstable alpha. Literally zero effort went into making it convenient to use; we were focused on getting it working in time for the conference.
Explore at your own risk but it is "unstable" precisely because it's not very convenient, and we need to change the API a few times until it's ready.
This is also why I think article authors shouldn't be using words like "simple" when referring to unstable things. They're not simple. They will be simple when we document them and make them convenient to use.
Again, I've used "simple" (also, with quotes) because the use-case is simple compared to what you demoed at JSconf - it just pops some text after clicking a button. Might have been a bad choice of words here. I'll note this for future articles.
Thanks! I think it’s very important to keep it mind that these articles are read by beginners who have very little context into what’s happening in React world so they take it at face value :-) I appreciate you playing with it but let’s make sure we don’t scare people off with wrong impressions before these features are ready.
Yeah, I was mostly commenting on it from the standpoint that it might be a bit too soon to start making "beginners guide to Suspense" :D
Yeah, the example is "simple" only in terms that it's not a full blown app like Dan demoed, guilty ;)
As for the API - there are multiple "parts" of it, most "bizarre" for me is the ReactDOM.unsafe_derefedUpdate part, which apparently is the main thing that will change.
This writeup is a bit more on the technical side than my other blogposts but I hope I was able to explain why we would need this feature, how it (currently) works and why it should make us happy :)