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

Replace defaultProps with default function parameters #260

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

wojtekmaj
Copy link
Contributor

As default props on function components are going to be deprecated in future release in favor of default function parameters (see: facebook/react#16210), I followed the recommendation. Note that default function parameters were actually already used (see lockProps for example)!

As default props on function components are going to be deprecated in future release in favor of default function parameters (see: facebook/react#16210), I followed the recommendation. Note that default function parameters were actually already used (see `lockProps` for example)!
Copy link
Owner

@theKashey theKashey left a comment

Choose a reason for hiding this comment

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

No objections. This is the only package under my maintanace still using propTypes and still configuring defaultProps.
Your change will ease future migration to TypeScript

@@ -34,7 +34,7 @@ const FocusLock = React.forwardRef(function FocusLockUI(props, parentRef) {
lockProps: containerProps = {},
sideCar: SideCar,

returnFocus: shouldReturnFocus,
returnFocus: shouldReturnFocus = false,
Copy link
Owner

Choose a reason for hiding this comment

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

😲 oh, it's disabled by default?! 🫠

@theKashey theKashey merged commit a69770f into theKashey:master Oct 12, 2023
@wojtekmaj wojtekmaj deleted the no-default-props branch October 12, 2023 09:15
@wojtekmaj
Copy link
Contributor Author

This is the only package under my maintanace still using propTypes and still configuring defaultProps.

Well, for these poor souls stuck on JavaScript for whatever reason, propTypes may actually come in handy. I personally keep it in all my TypeScript repositories anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants