Skip to content

Instantly share code, notes, and snippets.

@igorasilveira
Last active June 23, 2022 10:13
Show Gist options
  • Save igorasilveira/2884d265d093f43918e4f6cc4df88138 to your computer and use it in GitHub Desktop.
Save igorasilveira/2884d265d093f43918e4f6cc4df88138 to your computer and use it in GitHub Desktop.
function Doggo({ data }) {
// Render data...
}
// This gets called on every request
export async function getServerSideProps() {
// Fetch data from external data source
const res = await fetch(`https://.../data`)
const data = await res.json()
// Pass data to the page via props
return { props: { data } }
}
export default Doggo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment