@qvgk/react-toggle-theme
v1.4.3
Published
An updated, and reformed version of react-toggle-theme by forgng.
Downloads
2
Maintainers
Readme
About React Toggle Theme
React Toggle Theme was a React component originally created by forgng.
I saw that it had many issues that weren't getting fixed, so I decided to take it into my own hands and "reform" the module. I took out all packages that weren't needed, and fixed the ones that still remained. Then, I took the original code for the switch and put it here.
Oh, and I had to learn some TypeScript for this. You're welcome.
Installation
yarn add @qvgk/react-toggle-theme
npm install @qvgk/react-toggle-theme
Usage
import React, { useState } from "react"
import ToggleTheme from "@qvgk/react-toggle-theme"
export default function App() {
const [currentTheme, setCurrentTheme] = useState("light")
return (
<div style={{ backgroundColor: currentTheme === "light" ? "#000" : "#fff" }}>
<ToggleTheme selectedTheme={currentTheme} onChange={setCurrentTheme} />
</div>
)
}