Skip to content

Latest commit

History

History
39 lines (29 loc) 路 844 Bytes

File metadata and controls

39 lines (29 loc) 路 844 Bytes

inferno/no-find-dom-node

馃摑 Disallow usage of findDOMNode.

馃捈 This rule is enabled in the 鈽戯笍 recommended config.

Facebook will eventually deprecate findDOMNode as it blocks certain improvements in Inferno in the future.

It is recommended to use callback refs instead.

Rule Details

Examples of incorrect code for this rule:

class MyComponent extends Component {
  componentDidMount() {
    findDOMNode(this).scrollIntoView();
  }
  render() {
    return <div />
  }
}

Examples of correct code for this rule:

class MyComponent extends Component {
  componentDidMount() {
    this.node.scrollIntoView();
  }
  render() {
    return <div ref={node => this.node = node} />
  }
}