'ERROR Warning: Maximum update depth exceeded
This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
useEffect(() => {
hitAPI();
}, []);
const hitAPI = () => {
axios.get('https://restcountries.com/v2/all').then(response => {
setAllCountries(response.data);
let temp = [...response.data];
for (let i = 0; i < temp.length; i++) {
if (temp[i].callingCodes == 91) {
setSelectedItem(temp[i]);
}
}
console.log(setItem, 'item');
setloading(false);
});
};
@react-navigation/material-top-tabs using this for tab screen and after install pkg getting following error 'Attempts to invoke virtual method 'android.graphics.drawable android.graphic' error
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
