Create a component that fetches and displays a list of hardcoded items from a mock API.
MediumProblem Statement
Create a component that fetches and displays a list of hardcoded items from a mock API.
Sample Input
[{ "id": 1, "title": "Item 1" }, { "id": 2, "title": "Item 2" }]Sample Output
Item 1 Item 2
Limits
Time: 2s · Memory: 256 MB
Code Editor
Log in to submit00:00
Try your code in this preview. Submit marks it done.
import React, { useState, useEffect } from "react"; const FetchItems = () => { return ( <div> {/* Render fetched items here */} </div> ); }; export default FetchItems;