Skip to content

okotwal17/Nasa-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

NASA React App

The NASA React App is a project created to learn React while using the NASA API to fetch and display various data, including images from the Astronomy Picture of the Day (APOD) and Mars Rover photos. This app is an exploration of both the NASA API and React, providing insights into how to work with external APIs and manage application state in React.

Features

1. Astronomy Picture of the Day (APOD)

  • Fetch and display the daily astronomy picture along with a description and other metadata.

2. Mars Rover Photos

  • Retrieve images from the Mars Rover using the NASA API, allowing users to view the latest images captured on Mars.

3. User-Friendly Interface

  • Simple and clean UI that allows users to easily navigate between different space data (e.g., APOD, Mars Rover photos).

Tech Stack

  • Frontend: React
  • API Integration: NASA API (for APOD and Mars Rover data)
  • State Management: React useState and useEffect hooks
  • Styling: CSS (for basic styling)

Process and What I Learned

1. Setting Up the Project

  • Started with create-react-app to quickly scaffold the React app.
  • Installed necessary dependencies, including React, Axios (for API calls), and React Router (for navigation, if needed).

2. Fetching Data from NASA API

  • Used the NASA API to fetch the Astronomy Picture of the Day (APOD) and Mars Rover photos.
  • Used Axios to make HTTP requests to the NASA API endpoints.
  • Implemented asynchronous data fetching using useEffect to ensure data loads after the component mounts.

3. Managing State

  • Learned to manage application state using React’s useState hook to store API data.
  • Handled loading and error states to provide a better user experience.

4. Displaying Data

  • Used map() to display a list of Mars Rover photos and created a dynamic image gallery.
  • Rendered the APOD content in a user-friendly way with the picture and description.

5. Error Handling

  • Implemented error handling for API requests to ensure the app doesn't crash if there's an issue fetching data.

6. Styling

  • Created basic styles to display the data neatly. Focused on responsive design to make sure the app worked well on both desktop and mobile.

Lessons Learned

  • React Basics: Gained hands-on experience with core React concepts, including components, hooks (useState, useEffect), and state management.
  • API Integration: Learned how to integrate an external API and use asynchronous data fetching in a React app.
  • Error Handling: Implemented error handling for API requests to improve app reliability and user experience.
  • Styling: Improved CSS skills to create a clean and responsive design.
  • Debugging: Gained experience debugging React components and API requests.

Getting Started

  1. Clone the Repository

    • Clone the repository to your local machine using git clone.
  2. Install Dependencies

    • Run npm install to install the necessary dependencies.
  3. Run the App

    • Run npm start to launch the app in your browser.
  4. Explore the Data

    • Browse through the Astronomy Picture of the Day and Mars Rover photo gallery!

About

Built a React.JS app with the Nasa API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published