in useState we have an handler function, without this function how to disable a button after one attempt of click. I have use a Boolean variable but its not working fine
import React from "react";
export default function App() {
let disable = false;
const fun = () => {
alert("hi");
disable(false);
};
return (
<div>
<button disabled={disable}
onClick={(e) => {
if (disable) {
disable = true;
fun(e);
}
}}
>
Click Once
</button>
</div>
);
}