I\'m having some issues understanding why I\'m getting a compile warning on this piece of my react code
fetch(\'/users\')
.then(res => res.json())
From MDN:
The map() method creates a new array with the results of calling a provided function on every element in the calling array.
That means the map method has to be returned. So,you should change your code like this:
fetch('/users')
.then(res => res.json())
.then(data => {
data.map(users => {
return console.log(users);
});
});
or use forEach() instead of map()