leerob / leerob.io

✨ My portfolio built with Next.js, Tailwind, and Vercel.

Home Page:https://leerob.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it necessary to use MDXProvider from @mdx-js/react

payapula opened this issue Β· comments

Hi Leerob!

First of all thanks πŸŽ‰ for creating and providing such awesome content on Nextjs. Surely it helps many people like me in getting started with Next.

I see your blog is using next-mdx-remote which uses MDXProvider from @mdx-js/react under the hood. I also notice you surrounded all the components in the same provider on _app.js.

export default function App({ Component, pageProps }) {
  useAnalytics();

  return (
    <ThemeProvider attribute="class">
      <MDXProvider components={MDXComponents}>
        <Component {...pageProps} />
      </MDXProvider>
    </ThemeProvider>
  );
}

I did remove this MDXProvider and restarted the application, the MDX content are getting rendered as expected. So is it necessary to use this explicitly? If we can remove this then we don't need to include @mdx-js/react package.

Good catch! @mdx-js/react is a peer dep, so still needed though πŸ‘