react-find-dom-node
Replace .getDOMNode() calls with React.findDOMNode(...).
Usage
bash
Options
explicit-require: whenfalse, run even if no React import/require is present. Default:true.
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Replace getDOMNode() with React.findDOMNode()
Build your own codemod and share it with the community.
1 'use strict';
2
3 var React = require('React');
4
5 var Composer = React.createClass({
6 componentWillReceiveProps: function(nextProps) {
7 this.getDOMNode();
8 return foo(this.refs.input.getDOMNode());
9 },
10
11 foo: function() {
12 var ref = 'foo';
13 var element = this.refs[ref];
14 var domNode = element.getDOMNode();
15 },
16
17 bar: function() {
18 var thing = this.refs.foo;
19 thing.getDOMNode();
20 },
21
22 foobar: function() {
23 passThisOn(this.refs.main.refs.list.getDOMNode());
24 },
25 });
26
27 var SomeDialog = React.createClass({
28 render: function() {
29 call(this.refs.SomeThing);
30 return (
31 <div />
32 );
33 },
34 });
35