openedx / paragon

💎 An accessible, theme-ready design system built for learning applications and Open edX.
https://paragon-openedx.netlify.app
Apache License 2.0
119 stars 65 forks source link

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

Open ochavarria2u opened 4 months ago

ochavarria2u commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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.