Uncaught (in promise) TypeError: Cannot read property 'setState' of undefined
<p>For me this error is quite often when using axios. I can't setstate with undefined property. Eventhough i am getting actual response. I am pretty confused. Any solution would be appreciated.</p>

<p>json reply by 
axios reply</p>

<pre><code>[ { main: 1,
    left: 0,
    right: 0,
    top: 0,
    bottom: 0,
    cid: 6,
    '$created': '2016-10-21T11:08:08.853Z',
    '$updated': '2016-10-22T07:02:46.662Z',
    stop: 0 } ]
</code></pre>

<p>code.js</p>

<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
    export default class Main extends React.Component{
        constructor(props){
            super(props);
            this.state = {
                status:[]
            }
        }
        componentDidMount(){

            this.getdata()
        }
        getdata(){
            axios.get('/getactions')
                .then(function (data) {
                    console.log(data.data);

                    this.setState({
                        status:data
                    })
                })
        }

        render(){
            console.log(this.state)
            return(
                &lt;div&gt;
                   &lt;button &gt;Left&lt;/button&gt;

                &lt;/div&gt;
            )
        }
    }


    ReactDOM.render(&lt;Main/&gt;,document.getElementBy

Id('app'))
</code></pre>