Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 789 Bytes

File metadata and controls

28 lines (18 loc) · 789 Bytes

react/jsx-props-no-spread-multi

📝 Disallow JSX prop spreading the same identifier multiple times.

Enforces that any unique expression is only spread once. Generally spreading the same expression twice is an indicator of a mistake since any attribute between the spreads may be overridden when the intent was not to. Even when that is not the case this will lead to unnecessary computations being performed.

Rule Details

Examples of incorrect code for this rule:

<App {...props} myAttr="1" {...props} />

Examples of correct code for this rule:

<App myAttr="1" {...props} />
<App {...props} myAttr="1" />

When Not To Use It

When spreading the same expression multiple times yields different results.