Horje
disable a button react Code Example
disable a button react
// Input field listens to change, updates React's state and re-renders the component.
<input onChange={e => this.setState({ value: e.target.value })} value={this.state.value} />

// Button is disabled when input state is empty.
<button disabled={!this.state.value} />
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>




Javascript

Related
currying in javascript Code Example currying in javascript Code Example
react variable in stirng Code Example react variable in stirng Code Example
adding int and string in react props Code Example adding int and string in react props Code Example
how to create an id using mongoose Code Example how to create an id using mongoose Code Example
cors error in react Code Example cors error in react Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9