Download Youtube-Clone/src/components/DarkModeButton.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 377 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/components/DarkModeButton.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/components/DarkModeButton.jsx
-
curl -L -o DarkModeButton.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Youtube-Clone/src/components/DarkModeButton.jsx
377 Bytes
| import React from "react"; | |
| import { useDispatch } from "react-redux"; | |
| import { setDarkMode } from "../redux/darkModeSlice"; | |
| function DarkModeButton() { | |
| const dispatch = useDispatch(); | |
| return ( | |
| <button | |
| className="pr-4" | |
| onClick={() => { | |
| dispatch(setDarkMode()); | |
| }} | |
| > | |
| Switch Theme | |
| </button> | |
| ); | |
| } | |
| export default DarkModeButton; | |