【发布时间】:2021-08-04 08:00:01
【问题描述】:
当 React 中有两个 Button 组件时,这两个有什么区别?
const add = (x, y) => {
return x + y
}
案例一:
<Button onClick={() => add(1, 2)}>Add</Button>
案例 2:
<Button onClick={add(1, 2)}>Add</Button>
【问题讨论】:
标签: reactjs onclick components