Quantcast
Channel: How to dispatch a Redux action with a timeout? - Stack Overflow
Viewing all articles
Browse latest Browse all 15

Answer by Mohmmad Ebrahimi Aval for How to dispatch a Redux action with a timeout?

$
0
0

It is simple. Use trim-redux package and write like this in componentDidMount or other place and kill it in componentWillUnmount.

componentDidMount() {
  this.tm = setTimeout(function() {
    setStore({ age: 20 });
  }, 3000);
}

componentWillUnmount() {
  clearTimeout(this.tm);
}

Viewing all articles
Browse latest Browse all 15

Trending Articles