import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from './assets/vite.svg'
import heroImg from './assets/hero.png'
import './App.css'
import { api } from './api/index'
function App() {
const [count, setCount] = useState(0)
const [weatherData, setWeatherData] = useState(null)
const [weatherLoading, setWeatherLoading] = useState(false)
const [weatherError, setWeatherError] = useState(null)
async function fetchWeather() {
setWeatherLoading(true)
setWeatherError(null)
try {
const data = await api.wData()
setWeatherData(data)
} catch (e) {
setWeatherError(e.message)
} finally {
setWeatherLoading(false)
}
}
return (
<>
Edit 错误:{weatherError} {JSON.stringify(weatherData)}
Get started
src/App.jsx and save to test HMR
Connect with us
Join the Vite community