Address "Warning: Support for defaultProps will be removed from function components"
Describe the bug
Our application SCOUT uses version 12.0.0 of the design system and React version 18.3.1. When I run our tests, I see the following warning repeated for many components in the design system:
Warning: Spinner: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
at Spinner (scout/client/node_modules/@cmsgov/design-system/dist/react-components/esm/Spinner/Spinner.js:12:73)
Looking at the design system repo, it looks like defaultProps is still in use. I'm wondering if this is something that is being looked at for a future version.
(We also have our own code in SCOUT using defaultProps that needs to be updated).
To Reproduce
Steps to reproduce the behavior:
- Start an application like SCOUT that has version 12.0.0 of the design system and React version 18.3.1.
- Run the tests locally
- Alternatively, you can see a run in Jenkins
- Scroll through to see the warnings in the logs
Screenshots
Can be provided in Slack.
Expected behavior
I expect to not see the warning.
Additional context
- It looks like it started happening after a React update: https://cmsgov.slack.com/archives/CHH0381RD/p1721313796902659
- The reasons we'd like to fix this are:
- The amount of noise it creates in our logs makes it difficult to scan the logs for other issues
- It could block us from updating React
Thank you for raising this issue @night-jellyfish! We are in the process of upgrading to React 18.3.1 ourselves and hopefully when that happens we'll be able to address this issue directly. Thanks!
@night-jellyfish this should be addressed in this release. Are you ok with me closing this ticket?
Yes, thank you for fixing it and following up!