-
-
Save isilveira1/a6b649e3f5a64bf668e24918bcaf2131 to your computer and use it in GitHub Desktop.
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