Skip to content

Commit

Permalink
Better ssr example
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarscher committed Jan 5, 2024
1 parent b645c75 commit 0e32f3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions apps/next/app/ssr/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { SSRTestScreen } from './screen'
import { GetServerSideProps } from 'next'

export const runtime = 'edge'

export default function Page() {
return <SSRTestScreen></SSRTestScreen>
type Props = {
content: string
}

export const getServerSideProps = (async () => {
return {
props: {
content: 'This page is rendered on the edge. It is not statically rendered.',
}
}
}) satisfies GetServerSideProps<Props>

export default function Page(props: Props) {
return <SSRTestScreen content={props.content}></SSRTestScreen>
}
4 changes: 2 additions & 2 deletions apps/next/app/ssr/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import { Paragraph, YStack } from '@t4/ui'

export function SSRTestScreen() {
export function SSRTestScreen(props: { content: string }) {
return (
<YStack flex={1}>
<Paragraph role='heading'>
This page is rendered on the edge. It is not statically rendered.
{props.content}
</Paragraph>
</YStack>
)
Expand Down

0 comments on commit 0e32f3b

Please sign in to comment.