import { IonButton, IonButtons, IonCol, IonContent, IonHeader, IonIcon, IonPage, IonRow, IonTitle, IonToolbar, useIonRouter, } from '@ionic/react'; import { Geolocation } from '@capacitor/geolocation'; import { useEffect, useState } from 'react'; import { SkeletonDashboard } from '../components/SkeletonDashboard'; import { chevronBackOutline, refreshOutline } from 'ionicons/icons'; import { CurrentWeather } from '../components/CurrentWeather'; function Tab1(): React.JSX.Element { const router = useIonRouter(); const [currentWeather, setCurrentWeather] = useState(false); useEffect(() => { getCurrentPosition(); }, []); const getCurrentPosition = async () => { setCurrentWeather(false); const coordinates = await Geolocation.getCurrentPosition(); getAddress(coordinates.coords); }; const getAddress = async (coords) => { const query = `${coords.latitude},${coords.longitude}`; const response = await fetch( `https://api.weatherapi.com/v1/current.json?key=f93eb660b2424258bf5155016210712&q=${query}` ); const data = await response.json(); console.log(data); setCurrentWeather(data); }; // const router = useIonRouter(); function handleBackClick() { router.goBack(); } return ( My Weather getCurrentPosition()}> handleBackClick()}> Dashboard

Here's your location based weather

{currentWeather ? ( ) : ( )}
); } export default Tab1;