Add Logic to our Redux Reducers

Share this video with your friends

Send Tweet

So far our reducers have simply been used to update a single value passed in with an action. In this lesson we'll practice adding more logic into a reducer, which is recommended in the redux style guide. We will do this by removing a hard coded list of supported currencies to update based on the API call that we make.

One of the techniques we'll cover is using curly braces ({ and }) to create blocks inside of our switch statement, so that the variables we make while responding to an action don't leak into the outer scope.

~ 2 years ago

index.js:1 Warning: Encountered two children with the same key, USD. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause childr

Zac Jones
Zac Jones
~ 2 years ago

The React docs have a great article on where to get your keys from: https://beta.reactjs.org/learn/rendering-lists#where-to-get-your-key

Olumide
Olumide
~ 2 years ago

The logic added to this lesson for the rates/ratesReceived action isn't necessary anymore since we're now using a local mock API setup. I think