{"size": 1160, "ext": "js", "max_stars_repo_path": "src/reactReduxSaga2/components/Async/index.js", "max_stars_repo_name": "Gaara526/react-redux-train", "max_stars_repo_stars_event_min_datetime": "2018-12-27T10:02:41.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-27T10:02:41.000Z", "max_issues_repo_path": "src/reactReduxSaga2/components/Async/index.js", "max_issues_repo_name": "Gaara526/react-redux-train", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/reactReduxSaga2/components/Async/index.js", "max_forks_repo_name": "Gaara526/react-redux-train", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.2173913043, "max_line_length": 106, "alphanum_fraction": 0.5431034483}
/**
 * @since 2018-12-18 10:22
 * @author pengyumeng
 */

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button } from 'antd';
import 'antd/dist/antd.css';

import './index.pcss';

export default class FetchDataComponent extends Component {
    static propTypes = {
        handleClickFetch: PropTypes.func,
        handleClickCancel: PropTypes.func,
        data: PropTypes.object,
        data2: PropTypes.object,
    };

    static defaultProps = {
        handleClickFetch: () => {},
        handleClickCancel: () => {},
        data: null,
        data2: null,
    };

    render() {
        const {
            handleClickFetch,
            handleClickCancel,
            data,
            data2,
        } = this.props;

        return (
            <div>
                <Button size="large" className="numBtn" onClick={handleClickFetch}>async fetch</Button>
                <Button size="large" className="numBtn" onClick={handleClickCancel}>cancel fetch2</Button>
                {data !== null && <p>{data.msg}</p>}
                {data2 !== null && <p>{data2.msg}</p>}
            </div>
        );
    }
}
