Clear a field's value on input clear in react-final-form

后端 未结 3 1946
刺人心
刺人心 2021-01-20 19:08

I\'m using a custom component with react-final-form. On input change it sets the value to the address field. But when the input is cleared it doesn

3条回答
  •  悲哀的现实
    2021-01-20 19:26

    All the default callback are handle by the component. If you want to do a clear with a button click, you can create a custom component and use native callback methods do your thing.

    onChange = (event) => {
      this.setState({
        address:event.target.value
      });
    }
    
    onClear = () => {
      this.setState({
        address:''
      });
    }

提交回复
热议问题