Importing other .mdx
files
#904
-
Hello, I am trying to import other Is there something I'm missing? // page
---
title: "Some page"
---
import SomeMDXSnippet from "./snippet.mdx";
<SomeMDXSnippet />
The code block won't be styled properly using the ...defaultMdxComponents,
Tabs: Tabs,
Tab: Tab,
Steps: Steps,
Step: Step,
TypeTable: TypeTable,
// HTML `ref` attribute conflicts with `forwardRef`
pre: ({ ref: _ref, ...props }: any) => (
<CodeBlock {...props}>
<Pre>{props.children}</Pre>
</CodeBlock>
), In general, those MDX components do not apply to any .mdx imported snippet. I need to manually import |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's because the MDX components exported from MDX files accept the components prop, your current context (the original MDX file) has the components prop passed in but it's not shared to the imported MDX component. |
Beta Was this translation helpful? Give feedback.
It's because the MDX components exported from MDX files accept the components prop, your current context (the original MDX file) has the components prop passed in but it's not shared to the imported MDX component.