While using node fetch , i encounted this issues where is was getting this strange error 'Uncaught (in promise) TypeError: Cannot read property 'setState' of undefined' .

The issue was : this within a standard function is usually determined by how it's called, not where the function was created. So this in the callback function here is not the same as this outside it.

The second code has been written in arrow function format to encouter in issue.

 let url='https://www.cryptocompare.com/api/data/coinlist/';
        fetch(url).then(response => 
            response.json().then(data => {
                this.setState({items:data.Data});
            })
        );
let url='https://www.cryptocompare.com/api/data/coinlist/';
    fetch(url) 
        .then(function(res) {
            res.json().then(function(data){
                 this.setState({items:data.Data});

            })

        });

In above codes you can see then being used twice , this is because node fetch returns promise instead of data itself.