Change React component prop value
ProprietaryChanges literal prop values on React components. Useful for library upgrades where prop values were renamed (e.g., Material-UI, Ant Design).
org. openrewrite. react. migration. change-component-prop-valueRequired
The name of the React component to target
The name of the prop whose value should be changed
The new value to replace with. Can use $1, $2, etc. to reference capture groups if regex is true.
Optional
The old value to match. If regex is true, interpreted as a regular expression pattern. Supports /pattern/flags format for specifying regex flags (e.g., /pattern/i for case-insensitive). If not provided, matches all values.
If true, oldValue is interpreted as a regex pattern. Capture groups can be referenced in newValue using $1, $2, etc.
mod run . --recipe= org. openrewrite. react. migration. change-component-prop-value \
-P componentName= Button \
-P propName= variant \
-P newValue= outlined-primaryInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.