From cdb1ad607a4f9d8a1d1ddb5df3c0067b409099ca Mon Sep 17 00:00:00 2001 From: payapula Date: Sat, 22 May 2021 21:43:20 +0530 Subject: [PATCH 1/2] Updated with-mdx-remote dynamic components example Fixed the missing prop 'components' to and added a defaultComponent and source mdx to provide clarity on the example. --- examples/with-mdx-remote/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/with-mdx-remote/README.md b/examples/with-mdx-remote/README.md index 45d57da1ea461..1562eb08fdcd8 100644 --- a/examples/with-mdx-remote/README.md +++ b/examples/with-mdx-remote/README.md @@ -34,10 +34,12 @@ For example, here's how you can change `getStaticProps` to pass a list of compon ```js import dynamic from 'next/dynamic' +import Test from '../components/test' const SomeHeavyComponent = dynamic(() => import('SomeHeavyComponent')) -// ... +const defaultComponents = { Test } + export function SomePage({ mdxSource, componentNames }) { const components = { ...defaultComponents, @@ -46,10 +48,17 @@ export function SomePage({ mdxSource, componentNames }) { : null, } - return + return } export async function getStaticProps() { + const source = `--- + title: Conditional custom components + --- + + Some **mdx** text, with a default component and a Heavy component + ` + const { content, data } = matter(source) const componentNames = [ From 7544204720f5ccc105684ec6424bbff88240d943 Mon Sep 17 00:00:00 2001 From: BharathiKannanV Date: Fri, 28 May 2021 09:35:44 +0530 Subject: [PATCH 2/2] Fixed prettier issue - lint github action --- examples/with-mdx-remote/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with-mdx-remote/README.md b/examples/with-mdx-remote/README.md index 1562eb08fdcd8..8c08583dfb38e 100644 --- a/examples/with-mdx-remote/README.md +++ b/examples/with-mdx-remote/README.md @@ -48,7 +48,7 @@ export function SomePage({ mdxSource, componentNames }) { : null, } - return + return } export async function getStaticProps() {