Skip to content

Instantly share code, notes, and snippets.

@azeezat
Last active February 4, 2020 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azeezat/5851d5e4fecf93b41026928d27b1e810 to your computer and use it in GitHub Desktop.
Save azeezat/5851d5e4fecf93b41026928d27b1e810 to your computer and use it in GitHub Desktop.
Animation counter
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