📜  如何在反应中解决作为父级的 div 日志记录的点击 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:40.889000             🧑  作者: Mango

代码示例1
var App = React.createClass({
  handleParentClick: function (e) { 
    console.log('parent');
  },

  handleChildClick: function (e) {
    e.stopPropagation();
    console.log('child');
  },

  render: function() {
    return 

Click

; } }); ReactDOM.render(, document.getElementById('root'));