do not add empty object `= {}` as default `props`
Initial checklist
- [X] I read the support docs
- [X] I read the contributing guide
- [X] I agree to follow the code of conduct
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
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 = {}) {
Solution
export default function MDXContent(props) {
Alternatives
no alternative
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()
But some people don’t do that. Some people do
if they do it, they can do MDXContent({}) 😅
Also React always passes an object as props. Other JSX frameworks might not.
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.
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 😂
Hi team! Could you describe why this has been marked as wontfix?
Thanks, — bb
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