on-internet
← Community

react API calls(leaflet, ip Geolocation)

Stack Overflow ·

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 ( <div className="App font-Rubik"> <Map position={{...address}} /> </div> ); } // Map compo

Comments

Sign in or sign up to comment and upvote.

No comments yet.