Skip to content

Instantly share code, notes, and snippets.

@szaranger
Created August 7, 2022 00:52
Show Gist options
  • Save szaranger/66f61ad05a7f4410ae7ad31028d1de77 to your computer and use it in GitHub Desktop.
Save szaranger/66f61ad05a7f4410ae7ad31028d1de77 to your computer and use it in GitHub Desktop.
const Page = ({ data }) => <div>{data}</div>;
export const getServerSideProps = async () => {
const res = await fetch('https://path/to/your/api');
const data = await res.json();
return { props: { data } };
};
export default Page;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment