Skip to content

Commit b6e755f

Browse files
committed
update readme
1 parent e28bcc8 commit b6e755f

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

README.md

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,11 @@ npx react-codemod replace-use-form-state <path>
132132
Replaces usages of ReactDom.render() with createRoot(node).render().
133133

134134
`react-codemod`:
135-
136135
```sh
137136
npx react-codemod replace-reactdom-render <path>
138137
```
139138

140139
`codemod`:
141-
142140
```sh
143141
npx codemod react/19/replace-reactdom-render --target <path>
144142
```
@@ -147,6 +145,12 @@ npx codemod react/19/replace-reactdom-render --target <path>
147145

148146
Converts calls to `React.createElement` into JSX elements.
149147

148+
`codemod`:
149+
```sh
150+
npx codemod react/create-element-to-jsx --target <path>
151+
```
152+
153+
`react-codemod`:
150154
```sh
151155
npx react-codemod create-element-to-jsx <path>
152156
```
@@ -155,6 +159,12 @@ npx react-codemod create-element-to-jsx <path>
155159

156160
Renames the experimental `unstable_handleError` lifecycle hook to `componentDidCatch`.
157161

162+
`codemod`:
163+
```sh
164+
npx codemod react/error-boundaries --target <path>
165+
```
166+
167+
`react-codemod`:
158168
```sh
159169
npx react-codemod error-boundaries <path>
160170
```
@@ -167,6 +177,12 @@ only look at code inside of `React.createClass` calls and only update calls on
167177
the component instance or its refs. You can use this script to update most calls
168178
to `getDOMNode` and then manually go through the remaining calls.
169179

180+
`codemod`:
181+
```sh
182+
npx codemod react/findDOMNode --target <path>
183+
```
184+
185+
`react-codemod`:
170186
```sh
171187
npx react-codemod findDOMNode <path>
172188
```
@@ -175,6 +191,12 @@ npx react-codemod findDOMNode <path>
175191

176192
Converts manual function bindings in a class (e.g., `this.f = this.f.bind(this)`) to arrow property initializer functions (e.g., `f = () => {}`).
177193

194+
`codemod`:
195+
```sh
196+
npx codemod react/manual-bind-to-arrow --target <path>
197+
```
198+
199+
`react-codemod`:
178200
```sh
179201
npx react-codemod manual-bind-to-arrow <path>
180202
```
@@ -189,6 +211,12 @@ The wizard will ask for 2 options -
189211
* **Use arrow functions?**: converts to arrow function. Converts to `function` by default.
190212
* **Destructure props?**: will destructure props in the argument where it is safe to do so.
191213

214+
`codemod`:
215+
```sh
216+
npx codemod react/pure-component --target <path>
217+
```
218+
219+
`react-codemod`:
192220
```sh
193221
npx react-codemod pure-component <path>
194222
```
@@ -200,6 +228,12 @@ class transform can pick up the React component and turn it into an ES2015
200228
class. NOTE: This currently only works if you are using the master version
201229
(>0.13.1) of React as it is using `React.addons.shallowCompare`
202230

231+
`codemod`:
232+
```sh
233+
npx codemod react/pure-render-mixin --target <path>
234+
```
235+
236+
`react-codemod`:
203237
```sh
204238
npx react-codemod pure-render-mixin <path>
205239
```
@@ -213,6 +247,12 @@ npx react-codemod pure-render-mixin <path>
213247

214248
Replaces `React.PropTypes` references with `prop-types` and adds the appropriate `import` or `require` statement. This codemod is intended for React 15.5+.
215249

250+
`codemod`:
251+
```sh
252+
npx codemod react/React-PropTypes-to-prop-types --target <path>
253+
```
254+
255+
`react-codemod`:
216256
```sh
217257
npx react-codemod React-PropTypes-to-prop-types <path>
218258
```
@@ -223,6 +263,12 @@ npx react-codemod React-PropTypes-to-prop-types <path>
223263

224264
Adds `UNSAFE_` prefix for deprecated lifecycle hooks. (For more information about this codemod, see [React RFC #6](https://github.com/reactjs/rfcs/pull/6))
225265

266+
`codemod`:
267+
```sh
268+
npx codemod react/rename-unsafe-lifecycles --target <path>
269+
```
270+
271+
`react-codemod`:
226272
```sh
227273
npx react-codemod rename-unsafe-lifecycles <path>
228274
```
@@ -235,6 +281,12 @@ replaces the appropriate property accesses using `require('react-dom')`. It does
235281
not support ES6 modules or other non-CommonJS systems. We recommend performing
236282
the `findDOMNode` conversion first.
237283

284+
`codemod`:
285+
```sh
286+
npx codemod react/react-to-react-dom --target <path>
287+
```
288+
289+
`react-codemod`:
238290
```sh
239291
npx react-codemod react-to-react-dom <path>
240292
```
@@ -249,6 +301,12 @@ npx react-codemod react-to-react-dom <path>
249301

250302
Converts calls like `React.DOM.div(...)` to `React.createElement('div', ...)`.
251303

304+
`codemod`:
305+
```sh
306+
npx codemod react/React-DOM-to-react-dom-factories --target <path>
307+
```
308+
309+
`react-codemod`:
252310
```sh
253311
npx react-codemod React-DOM-to-react-dom-factories <path>
254312
```
@@ -257,6 +315,12 @@ npx react-codemod React-DOM-to-react-dom-factories <path>
257315

258316
Replaces `View.propTypes` references with `ViewPropTypes` and adds the appropriate `import` or `require` statement. This codemod is intended for ReactNative 44+.
259317

318+
`codemod`:
319+
```sh
320+
npx codemod react/ReactNative-View-propTypes --target <path>
321+
```
322+
323+
`react-codemod`:
260324
```sh
261325
npx react-codemod ReactNative-View-propTypes <path>
262326
```
@@ -268,6 +332,7 @@ Reorders React component methods to match the [ESLint](http://eslint.org/)
268332
rule](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md). (Defaults to ordering of the [Airbnb style
269333
guide](https://github.com/airbnb/javascript/blob/7684892951ef663e1c4e62ad57d662e9b2748b9e/packages/eslint-config-airbnb/rules/react.js#L122-L134).
270334

335+
`react-codemod`:
271336
```sh
272337
npx react-codemod sort-comp <path>
273338
```
@@ -280,6 +345,12 @@ The wizard will ask for 1 option -
280345

281346
* **Destructure namespace imports as well?**: If chosen, *namespace* imports like `import * as React` will *also* be converted. By default, it's false, so only default imports (`import React`) are converted.
282347

348+
`codemod`:
349+
```sh
350+
npx codemod react/update-react-imports --target <path>
351+
```
352+
353+
`react-codemod`:
283354
```sh
284355
npx react-codemod update-react-imports <path>
285356
```

0 commit comments

Comments
 (0)