Created
April 5, 2024 19:38
-
-
Save PaulieScanlon/135bb4ced464f7c8d5f0bffc6b83c5c2 to your computer and use it in GitHub Desktop.
Example Gatsby Route
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
// 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