From b1f1f81c2af0bd94212412daf7960f48785eca86 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Thu, 19 Oct 2023 13:30:27 +0200 Subject: [PATCH] Refactor some docs Closes GH-2375. Reviewed-by: Christian Murphy Reviewed-by: Titus Wormer --- docs/docs/using-mdx.mdx | 5 ++++- packages/mdx/readme.md | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/docs/using-mdx.mdx b/docs/docs/using-mdx.mdx index 61c07cb42..490cc73b5 100644 --- a/docs/docs/using-mdx.mdx +++ b/docs/docs/using-mdx.mdx @@ -82,7 +82,10 @@ function _createMdxContent(props) { export default function MDXContent(props = {}) { const {wrapper: MDXLayout} = props.components || {} return MDXLayout - ? _jsx(MDXLayout, Object.assign({}, props, {children: _jsx(_createMdxContent, props)})) + ? _jsx(MDXLayout, { + ...props, + children: _jsx(_createMdxContent, props)} + ) : _createMdxContent(props) } ``` diff --git a/packages/mdx/readme.md b/packages/mdx/readme.md index be738b595..65a3e66ff 100644 --- a/packages/mdx/readme.md +++ b/packages/mdx/readme.md @@ -108,7 +108,10 @@ function _createMdxContent(props) { export default function MDXContent(props = {}) { const {wrapper: MDXLayout} = props.components || {} return MDXLayout - ? _jsx(MDXLayout, Object.assign({}, props, {children: _jsx(_createMdxContent, props)})) + ? _jsx(MDXLayout, { + ...props, + children: _jsx(_createMdxContent, props) + }) : _createMdxContent(props) } ``` @@ -558,7 +561,10 @@ compile(file, {providerImportSource: '@mdx-js/react'}) + } return MDXLayout - ? _jsx(MDXLayout, Object.assign({}, props, {children: _jsx(_createMdxContent, {})})) + ? _jsx(MDXLayout, { + ...props, + children: _jsx(_createMdxContent, {}) + }) : _createMdxContent() ``` @@ -602,7 +608,10 @@ compile(file, {jsx: true}) export default function MDXContent(props = {}) { const {wrapper: MDXLayout} = props.components || {} return MDXLayout -- ? _jsx(MDXLayout, Object.assign({}, props, {children: _jsx(_createMdxContent, props)})) +- ? _jsx(MDXLayout, { +- ...props, +- children: _jsx(_createMdxContent, props) +- }) + ? <_createMdxContent {...props} /> : _createMdxContent(props) }