Passing an additional parameter with an onChange event

前端 未结 7 810
生来不讨喜
生来不讨喜 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 07:47

    In your handle event use double arrow function, there's no need to bind when using arrow function:

    handleChange = tags => (event) => {
        console.log(tags);
        console.log(event.target.value);
    }
    

    And in the Child:

    Tag 1:
    Tag 2:
    Tag 3:

提交回复
热议问题