score:3

Accepted answer

you could destructure out the value from the event and just do the setstate as the only statement.

({ target: { value } }) => this.setstate(prevstate => ({
  form: {
    ...prevstate.form,
    password: value
  }
}));

score:1

personally i would use this:

e => {
    let value = e.target.value;
    this.setstate({
        form: {
            ...this.state.form,
            password: value
        }
    });
}

score:1

just another idea for you :)

event => {
   const password = event.target.value;
   const form = { ...this.state.form, password };
   this.setstate({ form });
}

Related Query

More Query from same tag