Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useMedia When server side rendering, defaultState should be defined to prevent a hydration mismatches. #2672

Closed
chrispinkney opened this issue Jan 19, 2022 · 1 comment · Fixed by #2780
Assignees
Labels
area: front-end area: nextjs Nextjs related issues type: bug Something isn't working
Milestone

Comments

@chrispinkney
Copy link
Contributor

What happened:
While running the front-end the message in the title constantly appears.

What should have happened:
No error message should have occurred.

How to reproduce it (as precise as possible):
Run the front-end locally.

Environment:

  • OS: Manjaro Linux
  • Browser: Firefox 96
@chrispinkney chrispinkney added type: bug Something isn't working area: front-end area: nextjs Nextjs related issues labels Jan 19, 2022
@DukeManh DukeManh self-assigned this Jan 27, 2022
@DukeManh DukeManh added this to the 2.6 Release milestone Jan 27, 2022
@DukeManh
Copy link
Contributor

This warning comes from 'react-use/useMedia' hook. Basically, 'useMedia' hook is asking for a default state otherwise the browser will fall back to false when server-side rendering which might not match the client's state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end area: nextjs Nextjs related issues type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants