-
-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
4.35.1
Current Behavior
- Install and build react components with the latest stencil version
- Try to use those react-components in Nextjs (copy the generated react components.server.ts to the nextjs app and import those components)
Error:
_Uncaught Error: Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
- A server/client branch
if (typeof window !== 'undefined'). - Variable input such as
Date.now()orMath.random()which changes each time it's called. - Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.
It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
https://react.dev/link/hydration-mismatch_
Expected Behavior
The components should work in a nextjs application without hydration errors
System Info
Steps to Reproduce
- Install and build
- Link current directory by running 'npm link' in the root folder
- Open the frameworks/react folder and run 'npm run build' and 'npm run link'
- Open the nextjs-app-example and run 'npm link stencilssr && npm link stencilssr-react'
- Run 'npm run dev' and see the error in the console
Code Reproduction URL
https://github.com/JohannesSchwegler/stencilssr-demo
Additional Information
No response
jayEvans89, fab-berlin and cwojcik-ifthen
Metadata
Metadata
Assignees
Labels
No labels
