Browse Source

Formatting nit

main
Dan Abramov 2 years ago
parent
commit
ef41566f76
  1. 6
      beta/src/content/learn/responding-to-events.md

6
beta/src/content/learn/responding-to-events.md

@ -67,7 +67,7 @@ You defined the `handleClick` function and then [passed it as a prop](/learn/pas
* Are usually defined *inside* your components.
* Have names that start with `handle`, followed by the name of the event.
> By convention, it is common to name event handlers as `handle` followed by the event name. You'll often see `onClick={handleClick}`, `onMouseEnter={handleMouseEnter}`, and so on.
By convention, it is common to name event handlers as `handle` followed by the event name. You'll often see `onClick={handleClick}`, `onMouseEnter={handleMouseEnter}`, and so on.
Alternatively, you can define an event handler inline in the JSX:
@ -126,7 +126,7 @@ In both cases, what you want to pass is a function:
* `<button onClick={handleClick}>` passes the `handleClick` function.
* `<button onClick={() => alert('...')}>` passes the `() => alert('...')` function.
> [Read more about arrow functions.](https://javascript.info/arrow-functions-basics)
[Read more about arrow functions.](https://javascript.info/arrow-functions-basics)
</Pitfall>
@ -233,7 +233,7 @@ If you use a [design system](https://uxdesign.cc/everything-you-need-to-know-abo
Built-in components like `<button>` and `<div>` only support [browser event names](TODO:/apis/react-dom/events) like `onClick`. However, when you're building your own components, you can name their event handler props any way that you like.
> By convention, event handler props should start with `on`, followed by a capital letter.
By convention, event handler props should start with `on`, followed by a capital letter.
For example, the `Button` component's `onClick` prop could have been called `onSmash`:

Loading…
Cancel
Save