Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

ERROR Warning: Maximum update depth exceeded

$
0
0

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


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>