React API should be called with the correct number of arguments

  • REACT_MISMATCHED_COUNT_OF_ARGS
  • Error
  • Medium
  • react

This rule applies when React API is called with the wrong number of arguments.

Because React API has the specification for its arguments, arguments are useless or cause undefined behavior if the number of arguments does not match.

Noncompliant Code Example

View with compliant examples side by side
import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(<div>Hello</div>); // REACT_MISMATCHED_COUNT_OF_ARGS

Compliant Code Example

View with noncompliant examples side by side
import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(<div>Hello</div>, document.getElementById('root'));

Version

This rule was introduced in DeepScan 1.27.0.

See