Skip to content

Instantly share code, notes, and snippets.

@isilveira1
Last active June 15, 2022 09:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
// 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