Question from the React (legacy) test

What does this React component display?

Hard
class Time extends React.Component{
    constructor(props){
        super(props);
        this.state={order:[]};
    }

    componentWillMount(){
        setTimeout(()=>{
            this.setState({order: this.state.order.concat(1)});
        }, 1000);

        this.setState({order: this.state.order.concat(2)});
    }

    componentDidMount(){
      // httpCall is an asychronous dummy function
      // It can take between 500ms and 1500ms
        httpCall('/some/api'). then(()=>this.setState({order: this.state.order.concat(3)}));
    }

    render(){
        return(
           <div>
               {this.state.order.join(',')}
           </div>
        );
    }
}

What does this component display?
Check the possible answer(s):

Author: Victor SabatierStatus: PublishedQuestion passed 1274 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!