Create a button that, when clicked, displays an alert saying 'Button clicked!'.
EasyProblem Statement
Create a button that, when clicked, displays an alert saying 'Button clicked!'.
Sample Output
An alert box that says 'Button clicked!'
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const ClickAlert = () => {
const handleClick = () => {
// Add alert logic here
};
return (
// Add button element here and link the click handler
<></>
);
};
export default ClickAlert;
Expected Output
An alert box that says 'Button clicked!'