Skip to content

Commit b5abc1e

Browse files
authored
Merge pull request #3036 from gregorianrants/patch-5
naming convention for event props and handlers is misquoted from the react docs
2 parents 690b790 + ef2d98b commit b5abc1e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/content/1/en/part1c.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,10 @@ const App = () => {
629629
630630
Since we now have an easily reusable <i>Button</i> component, we've also implemented new functionality into our application by adding a button that can be used to decrement the counter.
631631
632-
The event handler is passed to the <i>Button</i> component through the _handleClick_ prop. The name of the prop itself is not that significant, but our naming choice wasn't completely random. React's own official [tutorial](https://react.dev/learn/tutorial-tic-tac-toe) suggests this convention.
632+
The event handler is passed to the <i>Button</i> component through the _handleClick_ prop. The name of the prop itself is not that significant, but our naming choice wasn't completely random.
633+
634+
React's own official [tutorial](https://react.dev/learn/tutorial-tic-tac-toe) suggests:
635+
"In React, it’s conventional to use onSomething names for props which represent events and handleSomething for the function definitions which handle those events."
633636
634637
### Changes in state cause rerendering
635638

0 commit comments

Comments
 (0)