Let's say I have a collection, consisting of 3 objects in my Tab-Navigator
of React-Navigation
, which is integrated into Redux. Each of these 3 screens of TN displays the data list of its own unique object. I use Redux to:
- fetchCollection from the online database on app start
- loadUpdatedObject from the online database if I made changes to any of its properties (add, edit, delete)
- filterDisplayedList by search predicate when the search is performed
- addItem, editItem, deleteItem (3 different action creators)
What would be the difference between storing the whole collection and filtered objects in:
1. In navigation.state.params
by assigning through:
navigation.SetParams(object)
2. In Redux Store directly by dispatching them from Action Creator(s) using: navigation.dispatch(type, payload)
Using
Redux Store
, we can access it anywhere from the app. You just need to connect the store with the containers.Using navigation
setParams
, u have do it for every screen i think.Better approach will be the redux as the business logic and everything will be separate and code will be cleaner and easy to maintain.