I\'ve a series of user data elements which I\'m collecting inside a React component using hooks.
const [mobile, setMobile] = useState(\'\');
const [username, set
You should add name
attributes to input tags. Each name must refer to key in AllValues
object.
const [allValues, setAllValues] = useState({
mobile: '',
username: '',
email: '',
password: '',
confirmPassword: ''
});
const changeHandler = e => {
setAllValues({...allValues, [e.target.name]: e.target.value})
}
return (
// ...
)