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

Support for defaultProps will be removed from function components in a future major release. #3043

Open
ochavarria2u opened this issue May 6, 2024 · 2 comments

Comments

@ochavarria2u
Copy link
Contributor

Feedback summary

Using React 18 I started to notice these warning messages for default props.
Warning: FormGroup: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

The console gets crowded with many of these messages, making it hard to check actual errors or any other important debug messages.

Improvements

Migrating default props to normal JS parameters.

CC: @adamstankiewicz

@brian-smith-tcril
Copy link
Contributor

We'll want to move away from using propTypes as well https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops

@adamstankiewicz
Copy link
Member

Thanks for flagging this, @ochavarria2u.

One important caveat we'll need to consider is how the Paragon docs site relies on propTypes and defaultProps to generate the props API sections for components (e.g., props API for Alert) as well.

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

No branches or pull requests

3 participants