Created
April 5, 2024 19:35
-
-
Save PaulieScanlon/7058e047088e1a673a84a4cc6d33551b to your computer and use it in GitHub Desktop.
Example Next.js Route (App Router)
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
// app/page.jsx | |
import ParentComponent from '../components/parent-component'; | |
const Page = async () => { | |
const data = await getData(); | |
return <ParentComponent data={data} />; | |
}; | |
async function getData() { | |
const response = await fetch('https://api.github.com/repos/vercel/next.js'); | |
const data = await response.json(); | |
return data; | |
} | |
export default Page; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment