`MDXCreateElement` not using the `components` mapping prop in v1.4.5
See original GitHub issueSubject of the issue
MDXCreateElement
not using the components
mapping prop
When trying to use component mapping
following the mdxjs
instructions from here, the mapped components’ styles don’t get rendered.
Your environment
- OS: MacOS 10.13.5
- Packages:
- “@mdx-js/loader”: “1.4.5”,
- “@next/mdx”: “9.0.5”,
- “next”: “latest”,
- “react”: “^16.7.0”,
- “react-dom”: “^16.7.0”
- Env:
- node v12.10.0
- npm v6.10.3
- Chrome 76
Steps to reproduce
Repro: https://codesandbox.io/s/nextjs-mdx-js-tnifm
This repro is a fresh install of Next.js
with only mdx-js
support added.
// source: pages/index.js
import Content from "../content/hello.mdx";
const MyH1 = props => <h1 style={{ color: "tomato" }} {...props} />;
const components = {
h1: MyH1
};
export default () => <Content components={components} />;
Expected behaviour
The h1
header should have a tomato
color.
Actual behaviour
The h1
header renders black.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
MDXCreateElement not using the components mapping prop
MDXCreateElement ` not using the `components` mapping prop in v1.4.5.
Read more >Controls - Storybook - JS.ORG
Storybook Controls gives you a graphical UI to interact with a component's arguments dynamically without needing to code. It creates an addon panel...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually, it doesn’t make sense to pass
components
on the Markdown component. Instead we have to wrap it with theMDXProvider
on which we passcomponents
.This is the good way to do it :
Finally fixed btw! Please try out the RC for MDX 2: https://v2.mdxjs.com