Some components trigger events/callbacks in response to user input. To add an event handler, pass a function as a prop to a React element:
Suppose we want to make a custom
CounterButton component with an
onIncrement callback. We can pass this prop into the
onPress of a Button.
Want to learn React Native in-depth?