Monday, February 5, 2018

Call out to the API to update data (POST or PUT) first before updating your store within the React paradigm?

You probably should put this step between the action and the dispatch instead of downstream from the dispatch. Otherwise you could update the store and then be unable to call the API and you'd have to update the store again to roll back what you did. Wait for a success from the API promise, then holla at yourself after you've hollered out the window.


Addendum 2/6/2018: It is not correct to think of this as React in an Angular app. Really this is Flux. Redux might be used as a state container at the store itself.

No comments:

Post a Comment