react-easy-themer
is a lightweight package that provides an easy way to manage themes in your React applications. With react-easy-themer
, you can easily switch between different themes.
- Easy Integration: Quickly integrate theme management into your React components.
- Theme Switching: Toggle between light and dark themes effortlessly.
- Customizable: Define custom theme styles and extend functionality as needed.
- Context API: Uses React Context API for efficient state management.
npm install react-easy-themer
src/App.jsx
import { Themer } from "react-easy-themer";
import Header from "./Header.jsx";
const App = () => {
return (
<Themer>
<Header />
</Themer>
);
};
export default App;
src/Header.jsx
import { useTheme } from "react-easy-themer";
const Header = () => {
const { toggleTheme } = useTheme();
return (
<header>
<h1>Header</h1>
<button onClick={toggleTheme}>Toggle Theme</button>
</header>
);
};
export default Header;