#22 - Setup Redux Store and Persist State | React Native open-source eCommerce App

preview_player
Показать описание
In this video, we will set up a Redux store with Redux, React-Redux, and Redux Toolkit. Also, we will use the redux-persist library to save the store state on app restart.

This video series about how I'm building a React Native open-source mobile eCommerce application connected to the Magento 2 backend. It will cover different topics in the development process.

Рекомендации по теме
Комментарии
Автор

Hi Dima, if I'm not mistaken, doesn't apollo-client also serves as a state management system, if yes, we could just use "apollo-client" and no need of redux

SanjeevYadavIT
Автор

Hi Dima, I'm facing one issue, in previous tutorial, you asked to set

```
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
},
},
```

this in apollo client

If I remove this *fetchPolicy*: 'no-cache` then In product Detail Screen, images are not showing, but if I have this setting, and I try to update a apollo cache manually using *cache.writeQuery*, it is preventing wherever I'm listening that particular cache to update autmatically.

Further Explanation: The way apollo client is setup, if I create a variable in apollo cache lets say *isLoggedIn*, and I update this variable manually using *cache.writeQuery*, wherever I will listen to this local variable using *useQuery* hook, it well get automatically updated as soon as *cache.writeQuery* is called.

But the *defaultOptions* that are mentioned above, are not allowing to auto update.

SanjeevYadavIT
visit shbcf.ru