React Fundamentals

0% completed

Previous
Next
Code Challenge

Challenge: Favorite Fruit Selector

Follow these instructions to complete your challenge:

  1. Create a functional component named FruitSelector in the App.jsx file.
  2. Inside this component, create an array of fruit names (e.g., "Apple", "Banana", "Orange", "Mango").
  3. Display a list of buttons, each representing a fruit.
  4. When a button is clicked, update a state variable to show which fruit was selected.
  5. Display the selected fruit in a <p> tag.

Expected Output:

Image

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next