Last active
February 4, 2020 14:30
-
-
Save azeezat/5851d5e4fecf93b41026928d27b1e810 to your computer and use it in GitHub Desktop.
Animation counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
class PageInfo extends Component { | |
state = { | |
counter:0 | |
} | |
counter = (minimum, maximum) => { | |
for (let count = minimum; count <= maximum; count++) { | |
setTimeout(() => { | |
this.setState({count}) | |
}, 1000); | |
} | |
} | |
componentDidMount() { | |
this.counter(0,75000) | |
} | |
render() { | |
return ( | |
<div className="stats-counter"> | |
<h3 id='stats-number'>{this.state.count}</h3> | |
</div> | |
); | |
} | |
} | |
export default PageInfo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment