Skip to content

Commit 368e419

Browse files
authored
Update part1d.md
There should also be asynchronous update handling for the right button as well.
1 parent 6bd23ab commit 368e419

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/content/1/en/part1d.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,23 @@ const App = () => {
335335

336336
So now the number of button presses is definitely based on the correct number of left button presses.
337337

338+
We can also handle asynchronous updates for the right button:
339+
340+
```js
341+
const App = () => {
342+
// ...
343+
const handleRightClick = () => {
344+
setAll(allClicks.concat('R'));
345+
const updatedRight = right + 1;
346+
setRight(updatedRight);
347+
setTotal(left + updatedRight);
348+
};
349+
350+
// ...
351+
}
352+
```
353+
354+
338355
### Conditional rendering
339356

340357
Let's modify our application so that the rendering of the clicking history is handled by a new <i>History</i> component:

0 commit comments

Comments
 (0)