Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 637 Bytes

no-jsx-complex-spread-prop.md

File metadata and controls

27 lines (17 loc) · 637 Bytes

no-jsx-complex-spread-prop

JSX Element does not contain complex spread props.

Rule Details

JSXElement spread props that use complex expressions severely hurts code readability.

Examples of incorrect code for this rule:

const MyComponent: React.FC = () => (
  <AnotherComponent {...(isAdmin ? adminProps : {})} />
);

Examples of correct code for this rule:

const computedProps = isAdmin ? adminProps : {};

const MyComponent: React.FC = () => <AnotherComponent {...computedProps} />;

Further Reading