-
Notifications
You must be signed in to change notification settings - Fork 97
fix: replace defaultProps with function default parameters
#2045
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
fix: replace defaultProps with function default parameters
#2045
Conversation
d4c3fc3 to
a14c2e7
Compare
Remove unused DEFAULT_THEME imports from styled components fix tests linting
029ec52 to
85576db
Compare
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.
defaultProps with function default parameters
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.
Very nice and thorough work! 🔥 💯 🚀
|
|
||
| StyledStatusIndicatorBase.defaultProps = { | ||
| theme: DEFAULT_THEME, | ||
| $size: 'small' |
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.
$size is always defined in consuming component. 💯
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.
Good catch during review! I completely forgot to explicitly call that out in my description 🙇🏼
Description
As of React v19
defaultPropsis fully deprecated. Currently in React v18 it does warn against this being removed, so we can easily migrate these within the codebase.This PR does the work of eliminating and replace
defaultPropswith one of two patterns:a. default parameter values (with destructuring)
b. nullish coalescing within
styled::attrs()callbacksDetails
Checklist
npm start)?bedrock)