“Отключить кнопку реагировать” Ответ

Отключить кнопку реагировать

// 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} />
Nasty Narwhal

Отключить кнопку в 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>
Lucky Ladybird

Ответы похожие на “Отключить кнопку реагировать”

Вопросы похожие на “Отключить кнопку реагировать”

Больше похожих ответов на “Отключить кнопку реагировать” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования