React + Redux and HTTP Request
It’s a bit confusing for starters to get how does React + Redux and HTTP Request work together. For example, how does the HTTP Request influence registered app states? How is it related to action?
It all melted down to fully understand what is each of React, Redux and HTTP Request designed for, and how does it work. So here we go:
React renders the UI with states and props.
Redux manages the states of React.
HTTP Request fired by an action doesn’t necessarily affect the states in Redux’s store. There’re two cases here:
- If the action firing a HTTP Request changes the UI, we need to design app states, register them to Redux store, dispatch them to change the UI
- If the action firing a HTTP Request doesn’t change any UI, we don’t need to add app states related to the HTTP Request. We can directly fire the HTTP Response from React