Cuando se hace clic en un botón (material ui) por segunda vez, quiero que ese botón esté deshabilitado ( disabled={true} ). No encontré ningún ejemplo relacionado con esto en StackOverflow.
<Button onClick={this.startDraw.bind(this)} disabled={} startIcon={<Brush />} >Al principio, se puede hacer clic en el botón. Cuando se hace clic en él, sucede algo, pero cuando se hace clic en este mismo botón por segunda vez, el botón debe desactivarse (ya no se puede hacer clic).
Para uso de componentes de clase
state = { count: 0 }; this.setState({ count: count + 1 }); // use this on your button clicky para la parte del botón
<Button onClick={this.startDraw.bind(this)} disabled={count == 2} startIcon={<Brush />} />para el componente funcional use este enfoque
const [count , setCount ] = useState(0); setCount(count + 1) // use this on your button call <Button onClick={this.startDraw.bind(this)} disabled={count == 2} startIcon={<Brush />} />