mirror of
https://github.com/facebook/react.git
synced 2026-02-27 03:07:57 +00:00
Lifting State Up more legible (#8691)
This commit is contained in:
committed by
Kevin Lacker
parent
86fbb9d583
commit
b8f0522cc6
@@ -187,6 +187,8 @@ Now we're passing down two props from Board to Square: `value` and `onClick`. Th
|
||||
|
||||
```javascript
|
||||
<button className="square" onClick={() => this.props.onClick()}>
|
||||
{this.props.value}
|
||||
</button>
|
||||
```
|
||||
|
||||
This means that when the square is clicked, it calls the onClick function that was passed by the parent. The `onClick` doesn't have any special meaning here, but it's popular to name handler props starting with `on` and their implementations with `handle`. Try clicking a square – you should get an error because we haven't defined `handleClick` yet. Add it to the Board class:
|
||||
|
||||
Reference in New Issue
Block a user