Currency Converter
In this assignment, you will create a React application that will convert various currencies.
For the data, you will use the API available here
Objectives
- Work with an API to display data
- Work with React
- Work with the React lifecycle (
componentDidMount
with classes oruseEffect
with hooks)
Requirements
- Use this API documentation to build a page that allows for conversion between multiple currencies - Note, do not specify the optional list of currencies, allow your code to dynamically determine them.
Setup
degit $GITHUB_USER/react-project-template CurrencyConverter
Explorer Mode
- Create a page that loads and shows the current currency conversion rates.
- Design the page yourself or use utility CSS libraries like: Bootstrap or Bulma or Tailwind
- Use
USD
as the base currency. - Allow the user to enter a currency amount (allow for decimal amounts like
42.12
) in USD. - Show the converted amount in each of the available currencies.
- Either update as the user types or include a button that performs the conversion when clicked.
- Show the currency only two decimal places. For example, do not show
42.123456789
only show42.12
-- You may need this method to help. How is your code dealing with the truncation? Is it rounding? Is it rounding fairly? How might you change this behavior?
Adventure Mode
- Ensure that invalid data is not converted. If the input cannot be interpreted as a number, do not convert that input. Do you want to allow negative numbers?
- Change the style of the input field to indicate when the number is invalid, perhaps change the input's color to red, or put a border around it?
- Allow the user to choose a new base currency other than USD.
- Allow the user to use a specific day in the past.
- HINT
- Fetch the conversion rates for that day.
- Show the updated conversion rates and converted amount.
Epic Mode
- Use react router to allow the user to specify the base currency in the URL