This file contains 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
const Doggo: NextPage = ({ dog }) => { | |
... | |
}; | |
// This function gets called at build time | |
export const getStaticProps: GetStaticProps = async () => { | |
// Call an external API endpoint to get a dog | |
const res = await fetch("https://.../dogs/a-doggo"); | |
const dog = await res.json(); | |
// By returning { props: { dog } }, the Doggo component | |
// will receive `dog` as a prop at build time | |
return { | |
props: { | |
dog, | |
}, | |
}; | |
} | |
export default Doggo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment