Skip to content

Instantly share code, notes, and snippets.

@AnishDe12020
Created December 11, 2021 13:35
Show Gist options
  • Save AnishDe12020/07472ef552f085b07fb6458abfe57726 to your computer and use it in GitHub Desktop.
Save AnishDe12020/07472ef552f085b07fb6458abfe57726 to your computer and use it in GitHub Desktop.
import { serialize } from "next-mdx-remote/serialize";
import { MDXRemote } from "next-mdx-remote";
import CustomMDXCode from "../components/CustomMDXCode";
export default function Home({ source }) {
return (
<div>
<MDXRemote
components={{ code: props => <CustomMDXCode {...props} /> }}
{...source}
/>
</div>
);
}
export const getStaticProps = async () => {
const source =
"```js template=react filename=App.js\nexport default function App() {\n return <h1>Just some text...</h1>\n}\n```";
const mdxSource = await serialize(source);
return { props: { source: mdxSource } };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment