Stop fetching data inside of Redux actions
We often get confused about fetching data and how to connect our frontend application with the backend and we always end up reading tonnes of articles. While fetching data from API we prefer Redux actions to fetch data followed by dispatching the Redux actions to update the store. Well, this logic is not totally wrong but it has the following consequences:
The main logic behind redux is that we will have a store where all the common values shared among components will be stored and actions that will help to dispatch any data to update the store using reducers. Our main agenda should be to keep it as simple as the definition.
Solution Steps
In this approach, we can give the user a better view of response from API, Most important is user experience, for example, loader, errors, internet connectivity or server is under maintenance this kind of issues are very often and certain to occur in application and not providing better transparency to the user regarding the issues will end up creating the bad user experience.
#redux #react #software-development #programming #api