Skip to content
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

[Demo] Remove useless defaultProps usage #9586

Merged
merged 3 commits into from
Jan 16, 2024
Merged

[Demo] Remove useless defaultProps usage #9586

merged 3 commits into from
Jan 16, 2024

Conversation

fzaninotto
Copy link
Member

React discourages the use of defaultProps and may one day remove support for it. They aren't even documented in the latest version of the React docs.

Our demos contain custom components that don't really need defaultProps, so this PR replaces it with real props.

Some custom components with defaultProps remain in the demo (StarRatingField, ColoredNumberField, etc) because removing defaultProps for them would lead to a lot of repetition. These currently need defaultProps and there is no better alternative for now.

React discourages the use of defaultPRops and may one day remove support for it.

Our demos contain custom components that don't really need defaultProps, so we replace it with real props.

Some custom components with defaultProps remain (StarRatingField, ColoredNumberField, etc) because removing defaultProps for them would lead to a lot of repetition. These currently need defaultProps and there is no better alternative for now.
@@ -22,17 +22,4 @@ const ReviewListMobile = () => {
);
};

ReviewListMobile.propTypes = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter warning in this file.

@djhi djhi merged commit ba9f534 into master Jan 16, 2024
11 checks passed
@djhi djhi deleted the remove-default-props branch January 16, 2024 11:31
@djhi djhi added this to the 4.16.7 milestone Jan 16, 2024
@fzaninotto fzaninotto mentioned this pull request Feb 26, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants