Currency Genie is a web application that allows users to convert between different currencies using live exchange rates. The application is built with React and uses custom hooks for fetching and managing currency data.
Check out the live demo of the app: Currency Genie
- Features
- Getting Started
- Installation
- Usage
- Custom Hook
- Optimization
- Technologies Used
- Contributing
- License
- Convert between multiple currencies
- Fetches live exchange rates from Open Exchange Rates API
- Swap currency options with ease
- User-friendly interface
Follow these instructions to get a copy of the project up and running on your local machine.
- Node.js and npm (Node Package Manager) installed on your machine
-
Clone the repository:
git clone https://github.com/danishshariff/CurrencyConverterApp.git
-
Navigate to the project directory:
cd CurrencyConverterApp
-
Install the dependencies:
npm install
Start the development server:
npm start
Open http://localhost:3000 in your browser to view the app.
The useCurrencyInfo
hook fetches the latest currency rates from the Open Exchange Rates API and provides the data along with any error encountered.
import { useEffect, useState } from "react";
function useCurrencyInfo() {
const [data, setData] = useState({});
const [error, setError] = useState(null);
useEffect(() => {
fetch(`https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID`)
.then((res) => res.json())
.then((res) => setData(res.rates))
.catch((err) => setError(err.message));
}, []);
return { data, error };
}
export default useCurrencyInfo;
- Memoization: Used hooks like
useEffect
to fetch data only when necessary, reducing unnecessary re-renders. - Lazy Loading: Implemented lazy loading for components where applicable.
- State Management: Managed state effectively to avoid redundant state updates.
- Modular Code: Organized the code into reusable components and custom hooks.
- Consistent Naming: Followed consistent naming conventions for files and variables.
- Linting: Used ESLint for maintaining code quality and catching potential issues early.
- React
- CSS for styling
- Open Exchange Rates API
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.