mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.76k stars 1.14k forks source link

do not add empty object `= {}` as default `props` #2548

Closed dimaMachina closed 1 month ago

dimaMachina commented 1 month ago

Initial checklist

Problem

I saw in the generated code an empty object as default props props = {}, this is unneeded as props are always object

export default function MDXContent(props = {}) {
image

Solution

export default function MDXContent(props) {

Alternatives

no alternative

wooorm commented 1 month ago

this is unneeded as props are always object

Who defines that?

I think it’s not needed when used as <MDXContent />. But some people don’t do that. Some people do MDXContent()

dimaMachina commented 1 month ago

But some people don’t do that. Some people do

if they do it, they can do MDXContent({}) 😅

remcohaszing commented 1 month ago

Also React always passes an object as props. Other JSX frameworks might not.

wooorm commented 1 month ago

People can indeed do MDXContent({}). And that’s probably good. But. Now people don’t have to. And indeed: what about other frameworks. I personally don’t think it’s worth a breaking change. For what benefit? And I worry about those frameworks.

dimaMachina commented 1 month ago

And indeed: what about other frameworks.

preact definitely should follow React convention, I guess their behaviour should be similar, about other frameworks, idk

For what benefit?

why do specify something that is technically is never will be used, to save some bytes too 😂

github-actions[bot] commented 1 month ago

Hi team! Could you describe why this has been marked as wontfix?

Thanks, — bb

remcohaszing commented 1 month ago

I would agree with this if it was just a React component, but MDX can be used in various ways.

Feel free to create your own recma plugin if you really want to remove the default argument