Replies: 1 comment 2 replies
-
I'd previously (4 years ago, wow) written a transform that would intersperse (There's also separate conversation to be had with libraries that do "static extraction", and where/how (and yet another conversation, separate from SSR but still regarding concurrent mode, whether calling Happy to make separate threads for these questions, but would love to hear what the react team is thinking about in general right now? |
Beta Was this translation helpful? Give feedback.
-
Most CSS-in-JS libraries support SSR in a pretty similar way to
styled-components
:That is, they rely on the React tree being rendered synchronously to accumulate all of the styles used, so that they can generate the final CSS for you to include in the document.
In #37 we can see that with the new SSR architecture, HTML is flushed to the browser incrementally as suspense boundaries are resolved on the server, not all at once at the very end. This seems to imply that compatible CSS-in-JS libraries can't rely on being able to put their styles in
<head>
or generating a single<style>
and instead need to support this sort of incremental flushing too, right?What should CSS-in-JS libraries that want to be compatible with the new Suspense SSR be doing instead? There was mention of built-in utilities to address issues like this so it would be interesting to hear if such a feature is in scope for the initial release of React 18 and if not, what libraries should do in the meantime.
Beta Was this translation helpful? Give feedback.
All reactions