constructor() {
super()
this.state = {
progressState: 0
}
}
tickProgress() {
if(progressState !== 100)
setTimeout(() => {
this.increaseProgress(10);
this.tickProgress();
}, 1000)
}
componentDidMount() {
this.tickProgress
}
increaseProgress(value) {
this.setState({ progressState: this.state.progressState + value });
}
render() {
return (
<div className="progress-loader" style={{ width: `${this.state.progressState}%` }}>Text</div>
)
}