Answer the question
In order to leave comments, you need to log in
How to make console.log execute only after the data has been written?
hello i have this code
const [data, setData] = useState({
email: "",
password: "",
passwordCheck: "",
phone: "",
username: "",
address: ""
})
const onChangeHandler = (event) => {
setData({...data, [event.target.name]: event.target.value})
console.log(data)
}
<label>E-mail*</label>
<input type="email" onChange={onChangeHandler} defaultValue={data.email} name="email"/>
<div className="form-error"></div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question