But i trying. I need get json from api. I get error:
TypeError: Cannot read property 'setState' of undefined(…)
const Main = React.createClass({
    getInitialState : function() {
    return {
      data: null
    };
 },
 componentDidMount: function() {
     axios.get('https://api')
         .then(function (response) {
            this.setState({data: response.data})
            console.log(response.data);
         })
         .catch(function (error) {
             console.log(error);
         });
        console.log('mount ' + this.state.data );
},
    render() {
        return (
            <h1>{JSON.stringify(this.state.data)}</h1>
        )
    }
})
export default Main;
Why i cant use setState from componentDidMount ?
 
     
    