Thanks for the thorough follow up! I'm not really huge into the JS ecosystem so SSR is still hazy. So let's say I built a React implementation of a shopping cart and stuff it into a shopping-cart.js. If a client issues a GET request to /shop, I build a template, include the relevant HTML and CSS and of course the JS file, and return that to the client. How is SSR different from that?
You know how typical React based website looks like - there is html with header, scripts, styles but without actual content, like it has <div id="main"></div> where React will be mounted as soon as application loads in the browser. With SSR this div will be prefilled with HTML, the same one as React would generate in the browser, but now it is done on the server. Make sense?
Oh yeah I get it now. "rendering" in this context pertains to the ReactDOM.render(document.getElementById('root'), <ShoppingCart />); which happens on the server as opposed to being done once the client loads the page.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the thorough follow up! I'm not really huge into the JS ecosystem so SSR is still hazy. So let's say I built a React implementation of a shopping cart and stuff it into a
shopping-cart.js
. If a client issues a GET request to/shop
, I build a template, include the relevant HTML and CSS and of course the JS file, and return that to the client. How is SSR different from that?You know how typical React based website looks like - there is html with header, scripts, styles but without actual content, like it has
<div id="main"></div>
where React will be mounted as soon as application loads in the browser. With SSR thisdiv
will be prefilled with HTML, the same one as React would generate in the browser, but now it is done on the server. Make sense?Oh yeah I get it now. "rendering" in this context pertains to the
ReactDOM.render(document.getElementById('root'), <ShoppingCart />);
which happens on the server as opposed to being done once the client loads the page.