Answers for "how to set condition for disabled button in react js"

0

disable button in jsx

const buttonRef = useRef();

const disableButton = () =>{
  buttonRef.current.disabled = true; // this disables the button
 }

<button
className="btn btn-primary mt-2"
ref={buttonRef}
onClick={disableButton}
>
    Add
</button>
Posted by: Guest on October-25-2021

Code answers related to "how to set condition for disabled button in react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language