You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:
What is the expected behavior?
A little about versions:
OS:
Browser (vendor and version):
React:
react-use:
Did this worked in the previous package version?
The text was updated successfully, but these errors were encountered:
The issue here is that useMountedState() from react-use returns a function that checks if the component is mounted, but it’s initially set to false. isMounted() will return false until the component is fully mounted on the client side.
A common solution to this in Next.js is to use a useEffect hook to check if the component has mounted. Alternatively, the next-themes library provides a resolvedTheme property that becomes available only after mounting. Here’s how you can modify your code to ensure it behaves as expected:
Use useEffect to set a mounted state.
Switch to resolvedTheme instead of theme to avoid the initial server-side mismatch.
What is the current behavior?
this always returns false, im doing something wrong ?
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than
react-use
. Paste the link to your JSFiddle or CodeSandbox example below:What is the expected behavior?
A little about versions:
react-use
:The text was updated successfully, but these errors were encountered: