Universal Data Retrieval
Learn the basics of popularly used universal data retrieval methods.
We'll cover the following
Server-side rendering is a synchronous operation and this makes it tricky to preload all the necessary data effectively. Being able to avoid the problems we underlined at the end of the previous section isn’t as straightforward as we might expect.
The root of the problem is that we’re keeping our routing logic within the React application, so, on the server, we can’t know which page we’re actually going to render before we call the renderToString()
method. This is why the server can’t establish whether we need to preload some data for a particular page.
Universal data retrieval is still really a nebulous area in React, and different frameworks or libraries that facilitate React server-side rendering have come up with different solutions to this problem.
Get hands-on with 1400+ tech skills courses.