You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Action contain both api calls and schema definitions. Action in essence should only contain messages to publish telling the redux reducer(consumer) what logic it needs to arrange the data. We should move these calls out of this file and adopt a paradigm for how to handle api calls/data modeling in the front end.
In the pass I have had a lot of success dealing with apis using the following resources
Essentially you want to write a wrapping function that only requires you to specify minimal data to hit a api source. Then in the reducer, you would want to run normalizr to organize the said data. This would create a paradigm where in order to hit a data source, you would follow the round of calling the wrapper function and adding a call to a reducer generating function for the data store incorporating you normalized schema.
Action contain both api calls and schema definitions. Action in essence should only contain messages to publish telling the redux reducer(consumer) what logic it needs to arrange the data. We should move these calls out of this file and adopt a paradigm for how to handle api calls/data modeling in the front end.
In the pass I have had a lot of success dealing with apis using the following resources
https://github.com/agraboso/redux-api-middleware
https://github.com/paularmstrong/normalizr
Essentially you want to write a wrapping function that only requires you to specify minimal data to hit a api source. Then in the reducer, you would want to run normalizr to organize the said data. This would create a paradigm where in order to hit a data source, you would follow the round of calling the wrapper function and adding a call to a reducer generating function for the data store incorporating you normalized schema.
Here is a good old blog post describing how you can wrap an api actions using this middleware which allows you to intercept the data to do things like schema, isLoading patterns, error Formatting, etc...
http://randycoulman.com/blog/2016/04/19/using-redux-api-middleware-with-rails/
The text was updated successfully, but these errors were encountered: