#Implement Dark mode in React Router 7
1 messages · Page 1 of 1 (latest)
So how do I create a client-side component on React Router 7?
Literally the code I use and it doesn't work as I said before
I know
i told u the fix above
But the code you provide here doesn't set the theme state in useEffect
localStorage is used in useState above useEffect
and that will not work
until useEffect, everything is server rendered by default
Ok I'll try later. Thanks for your help
You suggestion work but at what costs? 🥲
https://eslint-react.xyz/docs/rules/hooks-extra-no-direct-set-state-in-use-effect#failing
Fixed using ClientAction: https://reactrouter.com/start/framework/actions
you have somewhere example code I could take a look?
I like this solution https://github.com/sergiodxa/react-router-color-scheme-example