AntonioErdeljac / problem-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Data Fetcher: A React Hook Exercise

Overview

This project is designed to help you practice building a React component that fetches and displays data from an external API. It's a hands-on way to get comfortable with using hooks such as useState and useEffect, managing asynchronous operations with async/await, and handling loading and error states in a React application.

Objective

Your task is to create a UserData component that:

  • Fetches user data from the following API endpoint: https://jsonplaceholder.typicode.com/users/1
  • Displays the user's name and email
  • Properly handles loading and error states

Requirements

  • Use functional components and React hooks.
  • Implement the fetching of data within useEffect to ensure it's done when the component mounts.
  • Use async/await for the fetch operation.
  • Manage the state of the user data, loading status, and any potential errors with useState.
  • Ensure your component is reusable and well-structured.

Getting Started

  1. Clone this repository to your local machine.
  2. Navigate to the project directory and install dependencies:

About


Languages

Language:TypeScript 75.9%Language:CSS 18.7%Language:JavaScript 5.4%