Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #disable #button #jsx
ADD COMMENT
Topic
Name
9+1 =