Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a button that disables itself after being clicked once.

Easy

Problem 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

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;