componentDidMount() {
this.foo = () = {
//some code
setTimeout(func, 1);
};
};
componentWillUnmount() {
setTimeout(func, 1);
//some code
this.foo();
}
componentWillUnmount() {
const timeout = setTimeout(func, 1);
//some code
clearTimeout(timeout);
this.foo();
}
componentDidMount() {
this.foo = (timerToClear) = {
//some code
if (timerToClear) {
clearTimeout(timerToClear);
}
setTimeout(func, 1);
};
};
componentWillUnmount() {
const timer = setTimeout(func, 1);
//some code
this.foo(timer);
}