state = { disabled: false, }; handleButtonClicked = () => { //going back logic this.setState({ disabled: true, }); setTimeout(() => { this.setState(() => ({ disabled: false, })); }, 5000); }; render() { const { disabled } = this.state; return ( <button onClick={this.handleButtonClicked} disabled={disabled} > Button to be disabled </button> ); }