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.
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
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
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