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
Log in to submit00:00
Try your code in this preview. Submit marks it done.
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;