Skip to content
loading...

re: Understanding Server Side Rendering VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hi @christopherkade , thanks for sharing your thoughts. I never put in the effort to play with SSR libs/frameworks until this morning after reading...
 

Hi Brandon, I'm really glad the article pushed you to start working with SSR !

If I understood your first question correctly, you'd have an Express server that handles usual operations while having a client built using Next and server-rendered.

Either way, your individual pages would be queried to the server at each route. Doing REST, CRUD and authentication operations by querying your server is one thing, but getting the HTML on each route is another.

For your second question, I understand the confusion, so let me clarify:

Imagine you have an e-mail under /inbox/42 where 42 is the e-mail's ID. The index.html page related to this specific e-mail would need to be already rendered on the server in order for it to be SSR. This way, when you reach this page, the complete page (and therefore its content) would be received by the client.
In an SPA case, the data for the e-mail with an ID of 42 would be queried to the server as you'd normally do.

I really hope this helps, and thank you for your feedback !

 

Gotcha, definitely cleared up what I was thinking, thank you.

So I guess another question is what is technically SSR? You touch on it a bit in this post but with everything getting data from a RESTful endpoint this would typically mean even a simple blog grabbing a posts' content from a database wouldn't be considered SSR correct?

For example, if using Next and React, when requesting a blog post I would have a fetch request inside of the componentDidMount() method which is only called after the initial render() method. The way you've explained the Gmail scenario makes me think that this is no longer considered SSR even if using Next to render the page, correct? Another thought is that perhaps all of this is done on the server side, going through all of the React Component LifeCycle Methods before actually sending the HTML to the client which if that's the case then that would be considered SSR.

 

Is there a way to have a SSR SPA hybrid? So on the first request, it acquires a server rendered page and then all clicks after that work with a SPA which makes RESTful calls?

Nuxt and Next already do this. You only reach the server on the first request and then everything else works like a spa

code of conduct - report abuse