Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

DisableButton in React js

import {useRef} from 'react';
let btnRef = useRef();

const onBtnClick = e => {
  if(btnRef.current){
    btnRef.current.setAttribute("disabled", "disabled");
  }
}

<button ref={btnRef} onClick={onBtnClick}>Send</button>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #DisableButton #React #js
ADD COMMENT
Topic
Name
9+3 =