4 ms·
This is cool. What techniques did you use to include a copy of the data?
by victor106 6y ago
This is cool. What techniques did you use to include a copy of the data?
- gabipurcaru 6y agoit's just a bunch of JSON bundled inside the rest of the JS assets with webpack
- nexuist 6y agoI believe this entire technique is known as SSR - Server-Side Rendering. It's built in to Vue and React and you can find examples on their respective sites.
- asddubs 6y agothat's confusing, I've only ever heard SSR/server side rendering to mean actually rendering html and serving that, as opposed to SPAs
- nexuist 6y agoWell, the idea is that you render the first pass of the SPA and serve that HTML to the client. Rather than just injecting the data into the SPA source code, you inject the data and render the page, and then serve that page. Then whatever changes the user makes to the page after that initial load gets handled by the SPA. This way the user avoids having to wait for the SPA and all its dependencies to load before the page can even appear, and the developer doesn't have to differentiate between what happens on the client side and server side (remember using PHP to inject variables into JS source code?) because they can just bake it into their SPA.
- asddubs 6y agothat's pretty neat, I didn't know that react could do that. Shame no one ever seems to make use of it
- dr-detroit 6y agoBecause neat doesn't pay the bills. Why would I pay to dedicate computing resources to something that anyone's computer or phone can do in under 3 seconds which has scientifically been proven to be an acceptable wait time between click(tap) and render?