Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Fetching and Displaying Data | React Hooks and Context
Mastering React

Challenge: Fetching and Displaying DataChallenge: Fetching and Displaying Data

Task

Create a React component called DataFetcher that fetches and displays data from an API when the component mounts.

Instructions

  1. Import the appropriate hooks from the React library.
  2. Inside the component, use the useEffect hook to fetch data from the provided API endpoint when the component mounts.
  3. Display the fetched data in a user-friendly format within the component. You can choose how to format and present the data, such as a list, a table, or any other suitable format.
  1. Include an import statement to import the necessary hook from the React library.
  2. Utilize the useEffect and useState hooks for this task.

Tudo estava claro?

Seção 3. Capítulo 7
course content

Conteúdo do Curso

Mastering React

Challenge: Fetching and Displaying DataChallenge: Fetching and Displaying Data

Task

Create a React component called DataFetcher that fetches and displays data from an API when the component mounts.

Instructions

  1. Import the appropriate hooks from the React library.
  2. Inside the component, use the useEffect hook to fetch data from the provided API endpoint when the component mounts.
  3. Display the fetched data in a user-friendly format within the component. You can choose how to format and present the data, such as a list, a table, or any other suitable format.
  1. Include an import statement to import the necessary hook from the React library.
  2. Utilize the useEffect and useState hooks for this task.

Tudo estava claro?

Seção 3. Capítulo 7
some-alt