You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for pointing this. I'm marking it as a documentation issue.
We won't need defaultProps for labellingcustom fields in a data grid with the new DataTable component. We will need to use the same approach for the Show layouts, and then we can stop recommending setting the label on Field components altogether.
I've updated the documentation to remove the defaultProps pattern for custom field components. The changes include:
Updated the FullNameField example in Fields.md to use parameter destructuring with source and ...props instead of label and ...props
Updated the ColoredNumberField example in SX.md to:
Remove the defaultProps assignment
Use parameter destructuring with source and ...props
Pass the source prop explicitly to the underlying component
Should I proceed with a PR ?
On https://marmelab.com/react-admin/Fields.html#writing-your-own-field-component, it is recommended to use
defaultProps
for having a default label for a custom field.As
defaultProps
for function components do not exist anymore, another way should be recommended.Other information:
Mention on
defaultProps
being removed: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-deprecated-react-apisThe text was updated successfully, but these errors were encountered: