Skip to content

This project is a dynamic and interactive web application that provides users with a source of daily inspiration by fetching and displaying random advice from an external API. Built using React.js for the frontend and Axios for handling HTTP requests, this application is a great example of modern frontend development practices and API integration.

License

Notifications You must be signed in to change notification settings

raymondoyondi/Advice-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

💡 Advice Generator

This project is a dynamic and interactive web application designed to provide users with a fresh perspective and daily inspiration by fetching and displaying random quotes from an external API. Built using the powerful combination of React.js for the frontend and Axios for handling HTTP requests, this application serves as an excellent, practical example of modern frontend development practices and robust API integration.


🚀 Key Features

  • Daily Random Quotes: On page load or upon user interaction (e.g., clicking a button), the application fetches a new, unique piece of advice.
  • Modern Frontend Stack: Utilizes React.js (functional components and hooks) for a fast, component-based, and maintainable user interface.
  • Efficient Data Fetching: Implements Axios as the promise-based HTTP client, leveraging its features like automatic JSON transformation and a streamlined API for making requests to the advice service.
  • Interactive UI: A clean, intuitive design makes it easy for the user to quickly get new advice.
  • Responsive Design: Ensures a seamless experience across various devices and screen sizes.

💡 Technologies Used


💻 Installation and Setup

To get a copy of this project up and running on your local machine, follow these steps:

Prerequisites

Make sure you have Node.js and npm (Node Package Manager) installed.

Steps

  1. Clone the repository:

    git clone [https://github.com/raymondoyondi/Advice-Generator.git](https://github.com/raymondoyondi/Advice-Generator.git)
    cd advice-generator
  2. Install dependencies: This command will install all the necessary packages, including react, react-dom, and axios.

    npm install

    or

    yarn install
  3. Start the development server: This will compile the project and open it in your default web browser (usually at http://localhost:3000).

    npm start

    or

    yarn start

⚙️ Project Structure

The core logic for this application is straightforward and centered around fetching data with a React component.

  • src/App.js or src/components/AdviceCard.js: Contains the main logic for the component, including the state management for the current advice and the useEffect hook that handles the initial data fetch and subsequent fetches.

The Data Flow:

  1. The component mounts, and the useEffect hook triggers.
  2. An asynchronous GET request is made using Axios to the external API endpoint.
  3. The promise resolves, and the advice text is extracted from the response data.
  4. The React state is updated with the new advice, which automatically triggers a re-render of the component, displaying the new quote to the user.

🤝 Contributing

Contributions are always welcome! If you have suggestions for improving the code, adding new features, or fixing bugs, please feel free to:

  1. Fork the repository.
  2. Create a new feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

This project is a dynamic and interactive web application that provides users with a source of daily inspiration by fetching and displaying random advice from an external API. Built using React.js for the frontend and Axios for handling HTTP requests, this application is a great example of modern frontend development practices and API integration.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published