Skip to content
Advertisement

[Redux][Axios][React] Adding redux state inside of a axios / action file

I want to add/change a redux state when the data is received from the backend. This state controls a loading spinner. The code below is what I thought that should work.

What am I missing?

CouriersActions.js

JavaScript

Advertisement

Answer

A simple way of solving this kind issue, create custom hook for all services and where ever you need it.

JavaScript

Inside component

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement