0

I want to do server-side rendering with code splitting and the works. I'm using componentDidMount() to load data to be displayed.

Before delving into ReactDOMServer, I would like to know how it would handle these situations (in case it has shortcomings). How does the ReactDOMServer determine when the page has finished loading, and render it to HTML? Will it render before my data has been loaded?

5
  • React DOM server runs before the page starts loading to generate the markup that will be sent to the clientside. Think of it as running all your component constructors and render functions once, but on the server (so no window object access or browser only APIs). Not sure if this is what you're asking though. Commented Nov 6, 2019 at 7:32
  • @apokryfos so if I'm using React.lazy, will it render before or after the component has loaded? or will my spinner be rendered to html? Commented Nov 6, 2019 at 7:34
  • 1
    React.lazy specifically says it has no ReactDom/server support right now Commented Nov 6, 2019 at 7:35
  • React.Lazy will only load your component in the memory only when it is required. Provided you have used code splitting wiht webpack. Commented Nov 6, 2019 at 7:36
  • @apokryfos I guess that answers my question ;) Commented Nov 6, 2019 at 7:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.