https://github.com/foxbunny/vanilla-ssr-state-hydration
Examples of state hydration in a vanilla SSR setup
https://github.com/foxbunny/vanilla-ssr-state-hydration
Last synced: 3 days ago
JSON representation
Examples of state hydration in a vanilla SSR setup
- Host: GitHub
- URL: https://github.com/foxbunny/vanilla-ssr-state-hydration
- Owner: foxbunny
- Created: 2022-12-01T12:34:40.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-01T12:35:00.000Z (over 2 years ago)
- Last Synced: 2025-03-21T05:11:21.441Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vanilla SSR state hydration examples
This repository contains examples of "state hydration" vanilla SSR with NodeJS.
Each example is accompanied with its own README.md file that explains the
details.# Running the examples
The examples should run with most versions of NodeJS, but they are specifically
tested with the version 18 LTS.To run the examples, simply run the `server.js` in the individual folders.
After accessing the page, open the console to see the hydrated state.
# What is state hydration?
This is a term used by VDOM frameworks that support server-side rendering,
such as React and VueJS. Because most VDOM frameworks drive DOM changes
indirectly using state-change as a signal, they need to 'hydrate' the
client-side state storage once the server-rendered content is delivered to
the browser.Vanilla implementations technically do not need this feature as they do not
rely on state to drive the UI changes.So what's the point of this repository then? Even though state hydration is not
strictly needed, there are times when it is useful to create a client-side copy
of the data to speed up some operations or the other.