Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created April 5, 2024 19:38
Show Gist options
  • Save PaulieScanlon/135bb4ced464f7c8d5f0bffc6b83c5c2 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/135bb4ced464f7c8d5f0bffc6b83c5c2 to your computer and use it in GitHub Desktop.
Example Gatsby Route
// src/pages/index.js
import ParentComponent from '../components/parent-component';
const Page = ({ data }) => {
return <ParentComponent data={data} />;
};
export async function getServerData() {
const response = await fetch('https://api.github.com/repos/gatsbyjs/gatsby');
const data = await response.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