score:1

    this.name_change=()=>{
        let{name_arr,name}=this.state 
        
        //name_arr.push(name)      // can't manipulate state directly.
        this.setState(prevState => {
            let newNameArr = [prevState.name_arr, name]
            return {name_arr: newTipArray }
       })
    }

score:3

tip_change = () => {
  this.setState((prevState) => {
    const { tip, tip_arr } = prevState;
    return {
      tip_arr: [...tip_arr, tip]
    };
  });
}

Related Query

More Query from same tag