Search fetched items and set the header image on click

Develop a basic user interface that accomplishes the following tasks:
This UI challenge focuses on core UI skills: keeping state, running a side effect on load, splitting the UI into small pieces, and handling events. Styling is not a primary concern for this task, but the functionality to filter results and update the main image based on user interaction is crucial.
fetch('https://dummyjson.com/products'). The JSON response looks like this (only the fields you need are shown):
{
"products": [
{ "id": 1, "title": "iPhone 9", "images": ["https://.../1.jpg", "https://.../2.jpg"] },
{ "id": 2, "title": "iPhone X", "images": ["https://.../1.jpg"] }
]
}
<img> above the list. It is the first image in your app. Its src starts as products[0].images[0].Search.title and a Click Me button.Click Me button sets the header image src to that product’s images[0].Example Interaction:
1. Upon loading, the UI fetches data from the API and displays the first image as the main header image.
2. A list of titles is displayed below the header image, each with a corresponding "Click Me" button.
3. The user can type in the search field to filter the list of titles.
4. Clicking on a "Click Me" button next to a title updates the header image to that of the clicked item's image.
This task assesses your ability to handle data fetching, state management, and dynamic rendering, which are essential skills for frontend development.
The tests replace the API with fake products (no real network calls), then type, click, and read the screen like a real user would. You don’t need test ids, specific class names, or an exact HTML structure. They only check that:
https://dummyjson.com/products on load.Click Me button, in API order. Use a <button> (in React, any element with an onClick also works).<img> in your app has the src of the selected product’s images[0].aria-label, or name containing “Search”. Filtered-out products are removed or hidden (display: none, the hidden attribute, or aria-hidden="true").Capitalization and extra spacing in text don’t matter.