How to /Can I export function to MDXProvider?
See original GitHub issueI cannot find from the documentation.
I want to create and export some global utility function to MDX Context. Like the following codes:
function plusOne(a) {
return a + 1
}
<MDXProvider functions={{ plusOne }}>
<MDXRenderer>{some.body}</MDXRenderer>
</MDXProvider>
some.mdx
# H1
Some content
<Comp value={plusOne(10)} />
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Using MDX
This article explains how to use MDX files in your project. It shows how you can pass props and how to import, define,...
Read more >@mdx-js/react - unified
import {MDXProvider} from '@mdx-js/react' import Post from '. ... Additional components ( Components ) to use or a function that takes the current ......
Read more >Customizing Markdown Components - Gatsby
import { MDXProvider } from "@mdx-js/react". import * as DesignSystem from "your-design-system". export default function Layout({ children }) {. return (.
Read more >Advanced Features: Using MDX - Next.js
pages/index.js import { MDXProvider } from '@mdx-js/react' import Image from 'next/image' ... export default function Post(props) { return ( <MDXProvider ...
Read more >MDX and React - Docusaurus
You can also import your own components defined in other files or third-party ... export default function Highlight({children, color}) {
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
Why would that be a good idea? React also doesn’t let you access some global state in all your files 🤷♂️
Ops, the previous version example you wrote don’t use a
props
butimport
.That’s probably a new way for my MDX components design, Thanks!