My hook function
function useFormInput(initialValue){
const [value, setValue] = useState(initialValue);
function handleChange(e){
setValue(e.target.value);
}
return {
value,
onChange: handleChange
};
}
The way I called them independently inside a main function.
const name = useFormInput('Aziyat');
const rating = useFormInput('10');
As far as I understood, it automatically setValue when I declare them as name and rating(above code).
If I want to change the state of name and rating how do I do? Also, how can I use handleChange outside of the function?