We’re going to start out with an existing react application built with react hooks and add redux in piece by piece.
All of the code for this application can be found here: https://github.com/xjamundx/exchange-rate
To setup your app type:
git clone https://github.com/xjamundx/exchange-rate.git;
cd exchange-rate;
yarn;
yarn start;
There are primary in this repo you should be looking at:
main
branch features the currency exchange calculator using react hooks. That will be the basis for our course.redux
branch is basically the final state of the application after we apply redux.After I clone the Repo and do "npm install" I get this error
TypeError: Cannot convert undefined or null to object RateTable src/components/RateTable.js:2 1 | export function RateTable({ currencyData, amount }) {
2 | console.log(Object.entries(currencyData)); 3 | return ( 4 | <table className="ExchangeRate-table"> 5 |
Any suggestions ?
It looks like there's some sort of issue with the useEffect and the gettingExchangeRates function. Whenever I console.log(rates) it returns undefined, so when it sets the state it breaks the app. Not sure how to fix this though.
Luis and Rachel, thank you for your feedback. I believe the API we were hitting may have slightly changed on their end. I'll be diving in this today and later this week and make some adjustments to the code if needed. THANK YOU for letting me know about these issues.
I have updated the sample app on github to reflect the fact that the API changed to require an API key. All of the code that we use in the videos remains the same, but now there's a special fetch method I use that provides mock data instead actually hitting the server. You can run git pull
on a clean branch to get all of the latest changes. If you've already made changes to the code base you will want to run git stash
before you run git pull
. Let me know if you have any more issues with this lesson and thanks for reporting this issue.