Y
Y
yankoyski2019-04-23 18:32:30
JavaScript
yankoyski, 2019-04-23 18:32:30

How does Next js and ssr work?

Wondering how ssr works. In particular next.js.
There are two options in mind:
1. The client makes the first request - he receives html filled with content with other resources.
Further, the application works like a regular SPA. The application becomes more SEO friendly and loads the first page faster.
2. Filled html is given for each client request. React plays the role of a templating engine. The application ceases to exist as a SPA.
How does it actually work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2019-04-23
@yankoyski

First option.
The generated page with content is loaded. Scripts are loaded a little later. The page is alive. This process is called hydration.
The second option is you described Gatsby

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question