universal rendering: hydration does not happen
See original GitHub issueDescribe the problem:
Flareact claims to support universal rendering (both ESR and CSR). However, code does not seem to ever run on the client after rehydration, and it does not seem possible to detect when you’re running client-side.
Link to a minimal reproduction:
import React from 'react'
export default function Index() {
useEffect(()=>{ console.log('client effect') })
return (
<h1>
should print something to console upon page load
</h1>
);
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Hydration and Server-side Rendering - somewhat abstract
Without server-side rendering, the root node that we are giving here is entirely empty. When the ReactDOM.render call occurs, ...
Read more >react-hydration-error - Next.js
The first render is called Hydration which is a feature of React. This can cause the React tree to be out of sync...
Read more >How To Solve Hydration Error In Next.js | by Westin Tang
Error: Hydration failed because the initial UI does not match what was rendered on the server. The reason for the error has been...
Read more >Understanding Hydration in React applications(SSR)
Hydration is used only with server-side rendering (SSR). It is a process of rendering our components and attaching event handlers.
Read more >React Pre-rendering and Potential Hydration Issue
Hydration is done because of performance reasons. With hydration React does not have to render the whole page again in order to make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jplhomer Well, that’s strange. Just tested on a fresh project and its working as expected. Tested with different flareact and react versions too… I had the same problem @wizzard0 had when useEffect wasn’t firing unless router is imported. Took me a while to find why some pages didn’t work. Don’t know what to make of this.