React Props and Event Handling

Learn to pass and handle React props, customize components, and use event handlers in TypeScript.

We'll cover the following

React props

When we create a React component, we are able to give it properties that are handed down from the parent component to the child component. These properties can include both display properties and event handlers. As an example of this, let’s put a button on the screen and see how to both handle the onClick DOM event within the component itself and how to trigger an event on the parent component.

We will start by creating a new React component in a file named MyButton.tsx:

Get hands-on with 1400+ tech skills courses.