Create a Dark Mode Toggle Hook in React

preview_player
Показать описание
With this reuseable darkmode hook it gets easy to toggle dark and light mode throughout the application. With the current state saved in localStorage the user will even get his preferred setting on next visit.

-----------------------------------------------------

► Social Media
Рекомендации по теме
Комментарии
Автор

Hey I love the simple way you use for apply it :) Thanks it helps me

karinabelenescobar
Автор

Is there any other way besides using body in css?

khoilam
Автор

Best practice is not to use anonymous functions in your onclicks, can just call the name of the function directly. Also dont need to return true or false in an if, just use the condition itself.

guyfromdubai