Events

    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:

    Custom Events

    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?

    If you like React Native Express, you'll love my new book, Fullstack React Native: The complete guide to React Native! Throughout the book, we'll build 7 full apps, covering complex topics like navigation, gestures, and native modules. We don't assume any knowledge of React or newer JavaScript language features, so you can dive right in regardless of your experience level. The book comes in PDF, EPUB and MOBI formats.