I need to setInterval when main component. i tried setting it in constructor like
constructor(props) {
super(props);
this.props.fetchUserInfo();
this.props.fetchProducts();
setInterval(console.log('1'), 1000);
}
or inside componentDidMount
componentDidMount = () => {
setInterval(console.log('1'), 1000);
};
but it always logs '1' once. How to launch interval properly?