Satendra-singh-oos / Theme-Toggler-react

Theme Toggler in a React app using Context API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Theme Switcher in ReactJS

This is working example of theme switcher in ReactJS by using Context API Hook and CSS Variables.

Click Me For Live Demo

Files Strcuture

/Context: where we created the context

/HomePage: For Home-page

Walkthrough

/Context/ThemeContext.js : This file has the context of the theme

App.js : App.js has the provider of the theme and handling the logic of toggling the theme

App.css: CSS Variables for the theme

Conclusion:

We build a theme switcher in a React app using the useContext hook and the Context API. We implemented a theme context provider, created the necessary components, and updated the styles based on the selected theme. With this implementation, users can easily switch between different themes and update the background color of the app.


⭐ Do you have something to add or improve? Don't hesitate to do contribution. ⭐


❤️ You can follow me at Linkedin ❤️

About

Theme Toggler in a React app using Context API


Languages

Language:JavaScript 55.4%Language:HTML 25.9%Language:CSS 18.8%