score:1

Accepted answer
class Hello extends React.Component {
    state = {
        active: false
    }
    handleClick(e) {
        this.setState({
            active: !this.state.active
        });
        setTimeout(() => {
            this.setState({
                active: !this.state.active
            });
        }, 1000);
    }
    render() {
        return ( 
          <div className = { this.state.active ? "txt_vote_bar_div txt_vote_bar_div_active" : "txt_vote_bar_div txt_vote_bar_div_notactive" } onClick = { this.handleClick.bind(this) }></div>
        );
    }
}

ReactDOM.render( <
    Hello initialName = "World" / > ,
    document.getElementById('container')
);

score:1

handleClick(id) {

        this.setState({
            active: !this.state.active
        });

        // The timeout will trigger after 1000ms. Use a fat arrow function
        // to keep the same reference to this.
        setTimeout(() => {
            this.setState({
                 active: false
            });
        }, 1000);
}

Related Query

More Query from same tag