Exploring our Currency Exchange Application

Share this video with your friends

Send Tweet

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:

  • The main branch features the currency exchange calculator using react hooks. That will be the basis for our course.
  • The redux branch is basically the final state of the application after we apply redux.
Luis Feliz III
Luis Feliz III
~ 4 years ago

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 ?

Rachel Jackson
Rachel Jackson
~ 4 years ago

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.

Jamund Ferguson
Jamund Ferguson(instructor)
~ 4 years ago

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.

Jamund Ferguson
Jamund Ferguson(instructor)
~ 4 years ago

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.