Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer "A solution recommended by React Team"? #888

Closed
adbutterfield opened this issue Apr 1, 2022 · 6 comments
Closed

No longer "A solution recommended by React Team"? #888

adbutterfield opened this issue Apr 1, 2022 · 6 comments
Labels

Comments

@adbutterfield
Copy link

🐛 Bug Report

Not really a bug per say, but it looks like with React 18, this is no longer "A solution recommended by React Team"

I'll still have to use this for a while though, I don't think we can drop IE11 support yet where I work.

@chrischen
Copy link

reactwg/react-18#37

So React.lazy and Suspense will just work for SSR and bundle splitting now?

@adbutterfield
Copy link
Author

Haven't tried it yet myself, but according to the docs, seems like.

@chrischen
Copy link

chrischen commented Apr 11, 2022

I just looked at the SSR example given and it's not any more "just works" than loadable-components. Still need to wire up the initial chunks (via the new renderToPipeableStream), wire up the asset manifest from webpack, and inject static CSS if you use that. The wiring is also a bit different. Also doesn't work with renderToString (for SSR purposes at least).

However the demo does indeed render the React.lazy + component children on the server, but if you fetch data remotely inside a Suspense boundary it still gets punted to the client to load it gets server rendered and streamed to the client and displayed before the JS bundle is loaded.

@adbutterfield
Copy link
Author

I guess my main point is mention of loadable-components has been stripped from the React docs. (Regardless of whether what we get in v18 really does the same thing as loadable-components or not)

@theKashey
Copy link
Collaborator

Sounds like it. React 18 can handle code splitting out of the box, keeping Suspense boundaries not hydrated while styles are in flight. To some intent - facebook/react#22692

To support static CSS and optimise loading times one still need library like this.

@stale
Copy link

stale bot commented Jun 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 19, 2022
@stale stale bot closed this as completed Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants