V2 not working with mdx-js/react. The MDXProvider components does not work as a result of this
See original GitHub issueInitial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
@mdx-js/react; < v1.6.22, @mdx-js/loader; >v2
Link to runnable example
No response
Steps to reproduce
Start a project, install these dependencies
npm install @mdx-js/react@next
npm install @mdx-js/loader@next
Use the MDXProvider
from @mdx-js/react
to wrap your components, and apply the components
props to attempt styling or changing any HTML tag. It won’t work.
<MDXProvider components={{
p: <p style={{ color: 'red', fontSize: '1.6rem' }} {...props} />
}}>
<Component {...pageProps} />
</MDXProvider>
All paragraphs still remain black and 1rem.
Am using npm v 7.20.3
Expected behavior
I expect the paragraph to be styled according to the style for the p tag passed into the components
props
Actual behavior
It doesn’t change. Nothing works at all
Runtime
Node v16
Package manager
Other (please specify in steps to reproduce)
OS
Windows
Build and bundle tools
Next.js
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
components in MdxProvider is not working sometimes #2077
The component injected in MDXProvider works as expected. Actual behavior. Injected Component is undefined. Runtime. Node v14. Package manager.
Read more >Any attempt to access props in MDX component results in ...
I've tried wrapping the render in a MDX provider, in a conditional statement that checks for the specific props first, but nothing works....
Read more >gatsby-plugin-mdx - npm
Start using gatsby-plugin-mdx in your project by running `npm i ... like remark-gfm currently don't work out of the box with Gatsby.
Read more >Advanced Features: Using MDX - Next.js
MDX is a superset of markdown that lets you write JSX directly in your markdown files. It is a powerful way to add...
Read more >MDX and React - Docusaurus
In Docusaurus, this MDX component scope is provided by the @theme/MDXComponents component. It's not a React component, per se, ...
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
Finally! It worked. I removed the
next-mdx
. ThanksHere’s a working example: https://codesandbox.io/s/github/mdx-js/.github/tree/main/sandbox-templates/mdx-loader-next. Note especially that one tool is used: the loader. Not next-mdx which also adds the loader.