융융이'Blog

handleChange 간단하게 구현하기(State, setState이용) 본문

2022이전/React

handleChange 간단하게 구현하기(State, setState이용)

바로퇴장 2020. 2. 17. 15:48
...
  state ={
    id: '',
    name: '',
    category: '',
    error: '',
    checkID: false
  }
  ...
    handleChange = (e) =>{
    const { value, name } = e.target;
    this.setState( {[name]: value});
  }
  ...
  <Input type="select" onChange={this.handleChange}>