Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 422 Bytes

jsx-use-if-tag.md

File metadata and controls

34 lines (21 loc) · 422 Bytes

Use If tag (jsx-use-if-tag)

Use If tag instead of ternary operator.

Rule Details

The following patterns are considered warnings:

foo ? <div/> : null

foo ? <div/> : <span/>

The following patterns are not warnings:

<If condition={foo}>
    <div/>
</If>

<If condition={foo}>
    <div/>
<Else/>
    <div/>
</If>

When Not To Use It

If you are not using JSX, you can disable this rule