Write a React component that renders a button with a random label every time the page is refreshed.
EasyProblem Statement
Write a React component that renders a button with a random label every time the page is refreshed.
Sample Input
labels = ['Click me!', 'Press here!', 'Try me!']
Sample Output
The button displays a random label from the array.
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 from "react"; const RandomLabelButton = () => { const labels = ["Click me!", "Press here!", "Try me!"]; const randomLabel = "Picked Label"// Pick a random label from the array return <button>{randomLabel}</button>; }; export default RandomLabelButton;