reactjs / reactjs/react.dev

Setting the record straight on hydration

Open
#3,016 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

Anything I google related to react and hydration has the following blog post come up written by a prominent Google employee: https://addyosmani.com/blog/rehydration/

It shows the DOM being entirely destroyed and recreated as pictured below. The hydrate docs are a bit unclear about what exactly happens during hydration. They start out by saying that hydrate "is used to hydrate a container", but never explicitly define hydration. And so we must rely on blogs such as the one linked above to explain what hydration in more detail. After hours of digging through inaccurate information I'm pretty sure the above blog is terribly misleading.

If I'm right that Addy's image is incorrect, perhaps someone from Facebook could use their network to reach out and get this image corrected to reflect that the DOM is not destroyed? Otherwise, it would be helpful for React to have its own docs that explain hydration in more depth. The docs describe to some degree what happens during hydration, but not exactly why and leave a lot of ambiguity. E.g. why does hydration "patch up differences in text content" and why would such differences exist in the first place?

hydrate@2x

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked React hydrate documentation and the referenced hydration article, then compare their descriptions of DOM reuse and text mismatches. Update the React documentation so hydration is explicitly defined, its purpose is explained, and the causes of text-content differences are clear; the revised guidance should resolve the ambiguity raised here.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.