I am trying to create a clapping button similar to the Medium's button. My strategy is using a setTimeout function as is defined in the following paragraph.
addClap: function () {
this.setState({clap: this.state.clap + 1, now: this.state.now + 1});
return setTimeout(() => {
return sendClaps(this.props.item.url, this.state.now);
}, 3000);
}
Unfortunately, this doesn't work as I want. I would like to let the User hit the button how many times they want to and when they stop, send the clap-counter value to the backend.