Passing an additional parameter with an onChange event

前端 未结 7 819
生来不讨喜
生来不讨喜 2021-01-31 07:33

What I\'m trying to do:

I am trying to pass a string from a child component to the handleChange function of a parent component.

What cur

7条回答
  •  粉色の甜心
    2021-01-31 08:06

    When you are writing this:

    handleChange will be called immediately as soon as render is triggered.

    Instead, do it like this:

    this.props.handleChange("tags", e)}>

    Now the handleChange will be called when onChange handler is called.

提交回复
热议问题