Create a button that disables itself after being clicked once.
EasyProblem Statement
Create a button that disables itself after being clicked once.
Sample Output
The button text changes to 'Clicked!' and the button becomes disabled.
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React, { useState } from "react";
const DisableButton = () => {
const [isDisabled, setIsDisabled] = useState(false);
return (
<button
disabled={isDisabled}
onClick={() => {
// Disable the button and update the text
}}
>
Click Me
</button>
);
};
export default DisableButton;
Expected Output
The button text changes to 'Clicked!' and the button becomes disabled.