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
// This function gets called at build time | |
export const getStaticPaths: GetStaticPaths = async () => { | |
// Call an external API endpoint to get dogs | |
const res = await fetch("https://.../dogs"); | |
const dogs = await res.json(); | |
// Get the paths we want to pre-render based on dogs | |
const paths = dogs.map((dog: any) => ({ | |
params: { id: dog.id }, | |
})); | |
// We'll pre-render only these paths at build time. | |
// { fallback: false } means other routes should 404. | |
return { paths, fallback: false }; | |
} | |
export default Doggo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment