Closed tvogelsang closed 2 years ago
The general mechanism by which react-ssr-prepass
functions is walking the React tree and doing a cheaper render. It generally will either use the visitor function or support a primitive form of suspense, meaning if a promise is thrown, it'll await that promise before continuing the traversal, similar to React's usual server-side rendering with the added interruption of promises on the visitor function or on suspense.
Generally, what this means is that it'd expect you to implement suspense and fill up an SSR cache so that the second renderToString
call (or its stream variant) renders the full SSR HTML result, which can be reproduced on the client-side during rehydration
Hello,
Curious, any suggestion on getting this process to work with functional components over classes? Thanks!