{"size": 511, "ext": "js", "max_stars_repo_path": "src/components/AnimateNumber.js", "max_stars_repo_name": "Nathanw1014/portal-web", "max_stars_repo_stars_event_min_datetime": "2020-03-31T08:22:16.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-27T14:15:37.000Z", "max_issues_repo_path": "src/components/AnimateNumber.js", "max_issues_repo_name": "Nathanw1014/portal-web", "max_issues_repo_issues_event_min_datetime": "2020-07-15T07:53:05.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-15T07:53:50.000Z", "max_forks_repo_path": "src/components/AnimateNumber.js", "max_forks_repo_name": "Nathanw1014/portal-web", "max_forks_repo_forks_event_min_datetime": "2020-04-13T09:09:09.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-01T14:02:51.000Z"}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": 4, "avg_line_length": 19.6538461538, "max_line_length": 83, "alphanum_fraction": 0.6105675147}
import React from 'react';
import Animate from 'react-animated-number';

export default class AnimateNumber extends React.Component {
  state = {
    value: 0,
  };

  componentDidMount() {
    const { value, duration } = this.props;

    setTimeout(() => {
      this.setState({
        value,
      });
    }, 200);
  }

  render() {
    const { duration, formatValue } = this.props;
    const { value } = this.state;

    return <Animate value={value} formatValue={formatValue} duration={duration} />;
  }
}
