Skip to content

Instantly share code, notes, and snippets.

@Wanuja97
Created September 22, 2023 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wanuja97/b8e3a9535892823c07de255825dbccab to your computer and use it in GitHub Desktop.
Save Wanuja97/b8e3a9535892823c07de255825dbccab to your computer and use it in GitHub Desktop.
Static Site Generation in Next.js
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