Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to disable a button in react based on condition

import { useState } from "react";

function MyComponent(){
	const [disabled, setDisabled] = useState(false);
	return (
    	<button disabled={disabled} onClick={setDisabled}>Click to Disable</button>
    )
}
 
PREVIOUS NEXT
Tagged: #disable #button #react #based #condition
ADD COMMENT
Topic
Name
5+6 =