Using functional components as screens
Both class components and functional components can be used as screens. There is no performance difference between the two. Deciding which type component to use boils down to user preference.
#
Declaring static optionsStatic options are a great way to declare options close to where they are used. Declaring static options is done by first declaring the functional component, and then declaring the options on the function component.
#
Listening to navigation eventsNavigation events let you react to various events related to a specific component or the app itself. Read more about them here
In the example above, our listener is registered with the componentId
passed in the second argument, and will receive only its related events.
tip
underscopeio/react-native-navigation-hooks is a wonderful library which greatly simplifies usage with hooks by introducing dedicated hooks for each event. The following example, which is taken from their docs, shows how to listen to all appear events and a particular screen's appear events: