React js onClick can't pass value to method

后端 未结 30 2121
北荒
北荒 2020-11-22 07:05

I want to read the onClick event value properties. But when I click on it, I see something like this on the console:

SyntheticMouseEvent {dispatchConfig: Ob         


        
30条回答
  •  没有蜡笔的小新
    2020-11-22 07:18

    I realize this is pretty late to the party, but I think a much simpler solution could satisfy many use cases:

        handleEdit(event) {
            let value = event.target.value;
        }
    
        ...
    
        
    

    I presume you could also use a data- attribute.

    Simple, semantic.

提交回复
热议问题