ELI5 / coding

Do You Even Hydrate, Bro?

April 20, 20232 min read
Stay hydrated
Fun drinking game: take a shot of water every couple hours to make sure you’re healthy and hydrated.

ELI5 : hydration

When you ask a computer (a "server") on the internet (a "network of networks" ... a network is a group of computers linked with each other) to provide a web page, it needs to figure out how to collect and organize the information it provides to you (each time, a "response").

One way is to prepare a common response that mostly works, then to customize it for different people or situations. We call this a "template". Fill in the template with useful information by "render-ing" it. We may "pre-render" multiple versions and keep them handy until we figure out which one we want to use for each response.

After the template is filled in with all the customized information it needs to display, there are still parts of the web page that need to do things, in order to respond to the user. For example, there might be an element where you type your name and the web app remembers it. Or a button that the user presses, which tells the server to go on to the next page. Hydration turns on the ability to respond, or to interact.

The server must go through each template that's been filled in with customized information, determine the parts that need to be turned on, and turn them on by adding additional web browser instructions. Not just how to display things, but how to handle user interactions. This is called "hydration", or in some cases, "partial hydration" because it's faster to only activate the pieces that need to be used.

"Hydration is the process by which pre-rendered content is made interactable."

h/t building-a-react-static-site-generator-with-partial-hydration-in-100-lines-of-code

Reacthydrationlearn in public4/20
長話短說 (short + sweet):
Thanks for reading, anon!