react API calls(leaflet, ip Geolocation)
14:31 06 Oct 2022

working on a challenge from frontend mentor.an ip address tracker with Api calls feom react leaflet map and IP geolocation API and i'm having issues using the value of the props for the latitude and longitude. This is my code:

function App() {

  const [address, setAddress] = useState({})

  useEffect(()=>{
    try {
      axios.get('https://geo.ipify.org/api/v2/country,city?apiKey=at_FmUFGKJxGxjnnNkYNr9W2TAv3XShk&ipAddress=8.8.8.8')
      .then((res) => setAddress(res.data))
    } catch(err) {
      console.log('error')
    }},[])
  

  return (
    
); } // Map component const Map = (props) => { const lat = props.position?.location?.lat; const lng = props.position?.location?.lng; const location = [37.40599,-122.078514]; console.log([lat,lng]) // when logged on the console it shows the vaue of lat and lng but when I assign the values to the const location(location=[lat,lng]) it throws an error and refuses to render. return ( A pretty CSS3 popup.
Easily customizable.
); }; export default Map;
javascript reactjs leaflet