Created
September 22, 2023 14:00
-
-
Save Wanuja97/b8e3a9535892823c07de255825dbccab to your computer and use it in GitHub Desktop.
Static Site Generation in Next.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import TimeCard from './TimeCard' | |
async function getDateTime() { | |
const res = await fetch(`https://worldtimeapi.org/api/ip`,{cache: 'force-cache'}) | |
return res.json() | |
} | |
export default async function SSG() { | |
const result = await getDateTime() | |
const dateTime = result.datetime | |
return ( | |
<div> | |
<TimeCard title="Static Site Generation" timestamp={dateTime} description="This timestamp generated in the build time."/> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment