- Your views and components should rely on props and callbacks.
- The idea is simple:Screens and Views are not the same.
- FavoritesScreen uses that callback to tell the view to navigate to another screen.
- Keep your callbacks chained togetherEvery time one of your views exposes a callback which may be declared in another part of the app (for example, mapStateToProps), first invoke the actual callback passed on props.
- This enables you to, for example, Navigate to a screen and also fetch some information to feed the next view.Following the previous example, if FavoritesScreen told FavoritesView to navigate to the FavoriteScreen when selecting a Favorite, Redux would honor that, but also invoke some Redux actions.As you may see, every realm knows how to handle its stuff: Screens know how to navigate, Connected Views know how to handle redux actions and Views are dumb, stateless and rely on their props.5.
I’ve been working with React Native for quite a while now, both professionally and personally, and actually enjoy it. In this article I will describe some patterns I use. Keep in mind that whatever…
Continue reading “React Native Effective Patterns – The Poli – Medium”