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

Dark/Light Mode switch not working properly. #61

Open
TarunVishwakarma1 opened this issue Mar 9, 2025 · 0 comments
Open

Dark/Light Mode switch not working properly. #61

TarunVishwakarma1 opened this issue Mar 9, 2025 · 0 comments

Comments

@TarunVishwakarma1
Copy link
Contributor

TarunVishwakarma1 commented Mar 9, 2025

Image

when the user visits the page and is already in dark mode the toggle switch remains in light mode and dont change the theme. If click twice it changes to light and then works normally.

This bug is due to react component mounting before the theme is checked.

To eliminate this useEffect would be fine with theme as dependency array, as useEffect only runs when the component is mounted.

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

No branches or pull requests

1 participant