-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Remove useMDXComponents argument #80871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Remove useMDXComponents argument #80871
Conversation
The `useMDXComponents` function is always called without any arguments. It’s also always supposed to be a named export, not a default export. It’s also called during render. Defining React components during render is an anti-pattern. All components that were previously defined inside of `useMDXComponents`, are now defined outside of the function.
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Joseph <[email protected]>
The e2e files you removed are related to the other PR where we use a default |
Correct. Those files are redundant now. I’ll gladly restore them if desirable, but they don’t add any value anymore. |
Nah, I think test/integration/plugin-mdx-rs/mdx-components.js is enough |
return { | ||
...components, | ||
} | ||
const components = {} satisfies MDXComponents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with what we have further down too, or vice versa, but let's stick to one
const components = {} satisfies MDXComponents | |
const components: MDXComponents = {} |
What?
Fix the signatures of
useMDXComponents
.Why?
The
useMDXComponents
function is always called without any arguments. It’s also always supposed to be a named export, not a default export. It’s also called during render. Defining React components during render is an anti-pattern. All components that were previously defined inside ofuseMDXComponents
, are now defined outside of the function.How?
Manual fixes.