I have a giant form, and it's setup so that the handleChange method changes the state values of the data as the user types. I then want it to write to the mySql database, which I can also do, except currently, it writes after every keypress. I'm trying to figure out how to wait a few seconds after input stops, so that it doesn't do it after every single key press.
handleChange(e) {
const targetName = e.target.name;
const targetValue = e.target.value
this.setState({
[e.target.name]: e.target.value
});
console.log(`${targetName}: ${targetValue}`);
/// I want a timer here that will only move on if input has stopped for a few seconds.
/// Call to my database query will be here
}