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

Improved mounted useState code template #92

Closed
wants to merge 1 commit into from

Conversation

etcroot
Copy link

@etcroot etcroot commented Feb 28, 2022

This is just a README contribution edit.

  • Made it more dynamic
  • Added default export
  • Added useState & useEffect imports.

- Made it more dynamic
- Added default export
- Added useState & useEffect imports.
@vercel
Copy link

vercel bot commented Feb 28, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

next-themes-basic – ./examples/example

🔍 Inspect: https://vercel.com/paco/next-themes-basic/7AEx1fHAAG58tHVHMANVedi3Y4dB
✅ Preview: https://next-themes-basic-git-fork-etcroot-master-paco.vercel.app

next-themes-tailwind – ./examples/tailwind

🔍 Inspect: https://vercel.com/paco/next-themes-tailwind/2GBMZG2DLazbwXRoUBaXDPF7s2pn
✅ Preview: https://next-themes-tailwind-git-fork-etcroot-master-paco.vercel.app

@@ -311,25 +311,27 @@ const ThemeChanger = () => {
To fix this, make sure you only render UI that uses the current theme when the page is mounted on the client:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this change to make sense we need to update the code block above it too, so it's easier to see the difference between hydration safe/unsafe code (the mounted state)

pacocoursey added a commit that referenced this pull request May 5, 2022
pacocoursey added a commit that referenced this pull request May 5, 2022
* update hydration example [fixes #92]

* add section about CSS hide/showing of UI [fixes #95]

* add nonce to docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants