#thedivisor#By convention, event handler props should start with on, followed by a capital letter.#thedivisor#For example, the Button component’s onClick prop could have been called onSmash:#thedivisor#In this example, <button onClick={onSmash}> shows that the browser <button> (lowercase) still needs a prop called onClick, but the name of the prop given to your custom Button component is your choice!#thedivisor#When your component allows multiple interactions, you might name event handler props after concepts specific to your app. For example, this Toolbar component gets the event handlers onPlayMovie and onUploadImage:#thedivisor#Notice that the App component does not need to know what Toolbar does with onPlayMovie or onUploadImage. That is a detail of the Toolbar. Here, Toolbar passes them down as onClick handlers to its Buttons, but it could also activate them with a keyboard shortcut later. Naming props after interactions specific to your app, like onPlayMovie, gives you freedom to change how they are used later.#thedivisor#Make sure to use the right HTML tags for your event handlers. For example, to handle clicks, use <button onClick={handleClick}> instead of <div onClick={handleClick}>. Using a real HTML <button> allows built-in browser behaviors like keyboard navigation. If you do not like the default browser style of a button and want it to look more like a link or another UI element, you can do this with CSS. Learn more about writing accessible markup.#thedivisor#Event handlers will also catch events from any children your component may have. We say that an event “bubbles” or “propagates” up the tree: it starts where the event occurred and then goes up the tree.#thedivisor#This <div> contains two buttons. Both the <div> and each button have their own onClick handlers. Which handlers do you think will run when you click a button?#thedivisor#If you click either button, its onClick will run first, followed by the parent <div>’s onClick. So two messages will show up. If you click the toolbar itself, only the parent <div>’s onClick will run.#thedivisor#All events propagate in React except onScroll, which only works on the JSX tag you attach it to.