Skip to content

react/jsx-no-duplicate-props Correctness

What it does

This rule prevents duplicate props in JSX elements.

Why is this bad?

Having duplicate props in a JSX element is most likely a mistake. Creating JSX elements with duplicate props can cause unexpected behavior in your application.

Examples

Examples of incorrect code for this rule:

jsx
<App a a />;
<App foo={2} bar baz foo={3} />;

Examples of correct code for this rule:

jsx
<App a />;
<App bar baz foo={3} />;

How to use

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["react"],
  "rules": {
    "react/jsx-no-duplicate-props": "error"
  }
}
bash
oxlint --deny react/jsx-no-duplicate-props --react-plugin

References

Released under the MIT License.