react-19-replace-default-props
Replace React function component defaultProps assignments with ES default parameters.
This codemod mirrors react/19/replace-default-props from codemod/commons.
Usage
bash
Example
Before
tsx
After
tsx
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Replace React function component defaultProps with default parameters
Build your own codemod and share it with the community.
1 const MyComp = ({foo, ...props}) => {
2 console.log(props.bar)
3 }
4
5 MyComp.defaultProps = { foo: "hello", bar: "bye", test: 2 };
6