feat: test ISR

This commit is contained in:
Daniel Soares
2021-12-13 17:12:51 -03:00
parent aaaaedb73c
commit 2a1164d1fd
26 changed files with 295 additions and 192 deletions

View File

@@ -1,5 +1,24 @@
import { Home } from '../components/Home'
import { GetStaticProps } from 'next'
export default function HomePage() {
import { Home } from '../components/Home'
import { useFetchData } from '../hooks/useFetchData'
import { fetchData } from '../services/fetchData'
import type { Data } from '../types/Data'
type HomePageProps = {
data: Data
}
export default function HomePage({ data }: HomePageProps) {
useFetchData(data)
return <Home />
}
export const getStaticProps: GetStaticProps = async () => {
const data = await fetchData()
return {
props: { data },
revalidate: 1
}
}