Download Amazon-Clone-PERN-stack/src/components/custom_hooks/CustomHook.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 221 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/src/components/custom_hooks/CustomHook.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/src/components/custom_hooks/CustomHook.js
-
curl -L -o CustomHook.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/Amazon-Clone-PERN-stack/src/components/custom_hooks/CustomHook.js
221 Bytes
| import { useState } from "react"; | |
| function useToggle(initialValue) { | |
| const [state, setState] = useState(initialValue); | |
| const toggle = () => { | |
| setState(!state); | |
| }; | |
| return [state, toggle]; | |
| } | |
| export { useToggle }; | |