cfpb / hmda-frontend

Collection of HMDA frontend apps
Creative Commons Zero v1.0 Universal
12 stars 15 forks source link

[React] Warnings for next major release #2210

Closed Michaeldremy closed 3 months ago

Michaeldremy commented 4 months ago

In the next major React version release findDOMNode is going to be depreciated. The documentation recommends using createRef instead.

https://react.dev/reference/react-dom/findDOMNode#alternatives

Warning in the DEV console:

Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node

The places that are using findDOMNode:

Look to replace the findDOMNode or ignore the warning as the prop is being used in old test files.

In the next major React version release support for defaultProps for Inputs will no longer be supported.

Warning in the DEV console:

InputSubmit: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Good video to follow to make this change: https://www.youtube.com/watch?v=fnQusZt49_Y

Basically need to destructure the props and assign defaults to those passed in destructured props and remove the defaultProps from the code and the error in the console will go away.

The places that are using defaultProps:

Michaeldremy commented 4 months ago

Threw a build on DEV and all the tests are passing ✅