Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Latest commit

 

History

History
27 lines (20 loc) · 464 Bytes

prefer-lazy.md

File metadata and controls

27 lines (20 loc) · 464 Bytes

Prefer lazy expression

Enforces using a parameterless function which will only be invoked if the predicate is satisfied, allowing for lazy evaluation of inner JSX.

Rule Details

The following pattern is considered warning, when depth is 2:

renderIf(condition)(
  <div />
);

The following patterns are not considered warnings:

renderIf(condition)(() => (
  <div />
));
renderIf(condition)(function() {
  return <div />;
});