I was just introduced to a great use case for #reactjs Suspense in server side rendering. You can suspend on client side only data like browser width and height. Your server would send a loading state while your client code calculates the proper size.
2
3
21
So basically I request the page (comes with a tiny bit of js that grabs the window size), sends that info to the server, server renders the page and returns to the client?

Oct 17, 2018 路 8:57 AM UTC

Nope. You request the page which sends down the entire JS bundle. React mounts with a loading spinner while the code which requires client side state executes in the background. Once everything has loaded the full page appears.
1
1
The entire point of Suspense is to unblock rendering while data is loading. Once all the data comes in React flips the page to the final state. But it had the final state loaded in memory the entire time.
2