the simplest way is to have a function in onChange of input like:
<input value={quizName} onChange={(e)=>setQuizName(e.target.value)} />
Its okay!, But Please for the sake of GOD please stop doing this!
Here is the reason:
you are creating a function on every change of input and running it! this is not ok of performance vise! especially if you do it in a large scale app every where in your components!
what you need to do is just use useCallback
like below:
const [quizName, setQuizName] = useState("");
const handleInputChange = useCallback((e) => {
setQuizName(e.target.value)
}, [setQuizName])
return (
<input value={quizName} onChange={handleInputChange} />
)
here is a description of useCallback
in react documentations:
https://reactjs.org/docs/hooks-reference.html#usecallback