react事件

事件,我们都知道,这个很重要,说不定就要和使用者进行交互

如何添加事件

直接在jsx上面添加,利用on*, 例如:onClick,驼峰式

return (
      

You {text} this. Click to toggle.

);

参考:https://hulufei.gitbooks.io/react-tutorial/content/events.html

React map生成元素添加点击事件绑定this

我们直接在map上面添加事件是会保错的,解决方案,可以将map结果push进去。或者重新绑定this

{
  waveProvinceArr.map(function(waveProvinceItem){
    return 
  }.bind(this))
}

参考:https://www.jianshu.com/p/c130e7e791b6

你可能感兴趣的:(react事件)