21 lines
508 B
TypeScript
21 lines
508 B
TypeScript
import {lazy, Suspense } from "react"
|
|
import WeatherHistory from '@/hooks/weather-history'
|
|
|
|
const Chart = lazy(() => import("./temperature-plot-chart"))
|
|
|
|
function TemperaturePlot() {
|
|
const {data, isLoading, error} = WeatherHistory()
|
|
|
|
if (isLoading) return <p>Loading...</p>
|
|
if (error) return <p>Error: {error.message}</p>
|
|
return (
|
|
<Suspense fallback={<div className="h-[400-px]" />}>
|
|
<Chart data={data} />
|
|
</Suspense>
|
|
)
|
|
|
|
|
|
}
|
|
|
|
export default TemperaturePlot
|