-
Notifications
You must be signed in to change notification settings - Fork 93
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
Remove defaultProps which are deprecated in React #128
base: master
Are you sure you want to change the base?
Conversation
Drop defaultProps from the generated component as they are now deprecated and will be removed in React 19. They were added in airbnb#8 due to concerns about the overhead of `_extends` although no benchmarks were provided and it is likely that difference would be marginal where it matters. Fixes: airbnb#126
fcc0d0d
to
0038070
Compare
This seems like it'd be a breaking change, and React 19 isn't out yet (prereleases don't count). Instead of dropping them, there should be an option that skips them. |
Can you provide an example where this would be a breaking change? I don’t think there is much point of making it an option given that React has already deprecated them in the current release. This change, afaik, won’t break old React versions, will stop the warnings in the current release, and will keep working in the next release (19.x). |
"deprecated" is irrelevant, that's just a warning. They still work in React 18. The breaking change is one of the reasons it's a terrible idea to get rid of defaultProps from react - you can reflect on defaultProps from the outside, you can't read default arguments. |
They “work” but not without filling the console with warnings. This is not a question of agreeing or disagreeing with react team on the removal of If you can provide any concrete examples of how this is a breaking change maybe I can try to address them. Existing tests are passing. |
Basically, I think the only reasonable approach here is to add an option so you can opt in to "no defaultProps". |
I don’t think the public/documented API of this plugin is in any way affected by the removal of For me it does not make much sense to add a new option that we already know will not work in the next React version. |
The new option would be "no defaultProps" - ie, it'd be required in the next React version. |
Is there a way to stop the flood of console warnings on this in the meantime? |
I'm fine with updating this PR to have an option that skips the defaultProps - that would allow you to avoid the warnings. |
That would be ideal. Makes it quite painful to debug other issues amongst this. |
Drop
defaultProps
from the generated component as they are now deprecated and will be removed in React 19.They were added in #8 due to concerns about the overhead of
_extends
although no benchmarks were provided and it is likely that difference would be marginal where it matters.Fixes: #126