In my react project I need to use setInterval()
, but instead of repeatedly launching is launch only one time. (Pseudo code below) . Does anyone know how fix this? In other stackoverflow questions I doesn't find what I need.
/*---- React Component ----*/
class Grid extends Component {
componentDidMount() {
setInterval(timeline.launch(), 1000);
}
render() {
return (
<GridView />
)
}
}
/*---- Timeline Function ----*/
const $ = window.$;
class lifeTimeline {
launch() {
$(document).ready(function() { /* Render Timer on the screen */ }
}
}
const instance = new lifeTimeline();
export default instance;