Skip to content

Commit

Permalink
update remote example
Browse files Browse the repository at this point in the history
  • Loading branch information
eiiot committed Jan 23, 2024
1 parent 6abd5c8 commit 7d65f4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"clsx": "^2.0.0",
"framer-motion": "^10.0.0",
"next": "^13.5.6",
"next-mdx-remote": "^4.2.1",
"nextra": "workspace:*",
"nextra-theme-docs": "workspace:*",
"react": "^18.2.0",
Expand Down
20 changes: 10 additions & 10 deletions docs/pages/docs/guide/advanced/remote.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { useData } from 'nextra/data'
import { serialize } from 'next-mdx-remote/serialize'
import { MDXRemote } from 'next-mdx-remote'

export const getStaticProps = ({ params }) => {
const source = fetch(`https://gist.githubusercontent.com/eiiot/55984a720d8bf986b41d347b9895ed4b/raw/c6c48d57ca92ac2222cf358350494faf02c07d81/nextra-remote.md`)
.then(res => res.text())
const mdxSource = await serialize(source)
export const getStaticProps = async () => {
const sourceRes = await fetch(`https://gist.githubusercontent.com/eiiot/55984a720d8bf986b41d347b9895ed4b/raw/f7a100728a5f9723241a37d84c359db1e636304c/nextra-remote.md`)
const source = await sourceRes.text();
const mdxSource = await serialize(source);
return { props: { ssg: { source: mdxSource } } }
}

export const Remote = () => {
const { source } = useData()
const { source } = useData();
return <MDXRemote {...source} />
}

Expand All @@ -26,15 +26,15 @@ import { useData } from 'nextra/data'
import { serialize } from 'next-mdx-remote/serialize'
import { MDXRemote } from 'next-mdx-remote'

export const getStaticProps = ({ params }) => {
const source = fetch(`https://gist.githubusercontent.com/eiiot/55984a720d8bf986b41d347b9895ed4b/raw/c6c48d57ca92ac2222cf358350494faf02c07d81/nextra-remote.md`)
.then(res => res.text())
const mdxSource = await serialize(source)
export const getStaticProps = async () => {
const sourceRes = await fetch(`https://gist.githubusercontent.com/eiiot/55984a720d8bf986b41d347b9895ed4b/raw/f7a100728a5f9723241a37d84c359db1e636304c/nextra-remote.md`)
const source = await sourceRes.text();
const mdxSource = await serialize(source);
return { props: { ssg: { source: mdxSource } } }
}

export const Remote = () => {
const { source } = useData()
const { source } = useData();
return <MDXRemote {...source} />
}

Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d65f4d

Please sign in to comment.