Both functional and class components can be typed to get the benefits of strongly typed options and props.
- Class Component
- Functional Component
Arguments are passed to components view the
passProp. This is a common source for errors as these props tend to change overtime. Luckily we can type the passProps property to avoid these regressions. The example below shows how to declare types for passProps when pushing a screen.
The following commands accept typed passProps: