Skip to main content

react/noFindDOMNode

prevent usage of findDOMNode

ESLint Equivalent: no-find-dom-node

Examples

Invalid

findDOMNode(this).scrollIntoView()

 file.tsx:1 lint/react/noFindDOMNode ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Avoid using the findDOMNode function.

    findDOMNode(this).scrollIntoView()
    ^^^^^^^^^^^

  React plans to deprecate the findDOMNode function entirely since it
    prevents internal optimizations. Use callback refs instead.


ReactDOM.findDOMNode(this).scrollIntoView()

 file.tsx:1 lint/react/noFindDOMNode ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Avoid using the findDOMNode function.

    ReactDOM.findDOMNode(this).scrollIntoView()
    ^^^^^^^^^^^^^^^^^^^^

  React plans to deprecate the findDOMNode function entirely since it
    prevents internal optimizations. Use callback refs instead.

Valid

this.node.scrollIntoView()