I got two inputs. If I want to bind the input value with a state variable, I use this -
The state :
const [message, setMessage] = useState('')
const [newUser, setNewUser] = useState('')
The methods the bind them :
const handleMessageChange = (e) => setMessage(e.target.value)
const handleUserChange = (e) => setNewUser(e.target.value)
And I call these methods with the onChange property on the input.
My qusetion :
Can I use a generic handleChange method instead of explicitly creating a method to each input/state pair? If so, how?