How to use the @mdx-js/react.withMDXComponents function in @mdx-js/react

To help you get started, we’ve selected a few @mdx-js/react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gatsbyjs / gatsby / packages / gatsby-plugin-mdx / wrap-root-element.js View on Github external
})

const components = Object.entries(componentsAndGuards)
  .map(([name, arr]) => {
    return {
      [name]: componentFromGuards(
        arr.concat({ guard: undefined, Component: name })
      ),
    }
  })
  .reduce((acc, obj) => {
    return { ...acc, ...obj }
  }, {})

// merge any components in wrapRootElement above this wrapRoot
const MDXConsumer = withMDXComponents(
  ({ components: componentsFromContext, children }) => (
    
      
        {children}
      
    
  )
)

const WrapRootElement = ({ element }) => {element}

export default WrapRootElement

@mdx-js/react

React context for MDX

MIT
Latest version published 1 month ago

Package Health Score

97 / 100
Full package analysis