import React from "react"; import ConfirmBattle from "../components/ConfirmBattle"; import githubHelpers from "../utils/githubHelpers"; class ConfirmBattleContainer extends React.Component { constructor(props) { console.log("Constructor (getInitialState)"); super(props); this.state = { isLoading: true, playerInfo: [] }; } componentWillMount() { console.log("componentWillMount"); } componentDidMount() { console.log("componentDidMount"); const query = this.props.location.query; // Fetch info from Github then update state. githubHelpers.getPlayersInfo([query.playerOne, query.playerTwo]) .then((info) => { this.setState({ isLoading: false, playerInfo: info }); }); } componentWillReceiveProps() { console.log("componentWillReceiveProps"); } componentWillUnmount() { console.log("componentWillUnmount"); } componentWillUpdate(nextProps, nextState) { console.log("componentWillUpdate: loading ?", nextState.isLoading); } render() { return ( ); } } ConfirmBattleContainer.contextTypes = { router: React.PropTypes.object.isRequired }; export default ConfirmBattleContainer;