Last active
May 9, 2020 05:46
-
-
Save mikekoro/aee12e94eee0c946938fd1853001e9a4 to your computer and use it in GitHub Desktop.
Re-useable Custom Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// useValue.js | |
import React, { useState } from 'react'; | |
export const useValue = (initial_value) => { | |
const [value, setValue] = useState(initial_value); | |
const assignValue = (input) => { | |
setValue(input); | |
} | |
return { value, assignValue }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment