question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V2 not working with mdx-js/react. The MDXProvider components does not work as a result of this

See original GitHub issue

Initial checklist

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:closed
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Elijah-trillionzcommented, Jan 25, 2022

Finally! It worked. I removed the next-mdx. Thanks

1reaction
wooormcommented, Jan 25, 2022

Here’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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found