rendering-conditional-render

Use Explicit Conditional Rendering

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rendering-conditional-render" with this command: npx skills add theorcdev/8bitcn-ui/theorcdev-8bitcn-ui-rendering-conditional-render

Use Explicit Conditional Rendering

Use explicit ternary operators (? : ) instead of && for conditional rendering when the condition can be 0 , NaN , or other falsy values that render.

Incorrect (renders "0" when count is 0):

function Badge({ count }: { count: number }) { return ( <div> {count && <span className="badge">{count}</span>} </div> ) }

// When count = 0, renders: <div>0</div> // When count = 5, renders: <div><span class="badge">5</span></div>

Correct (renders nothing when count is 0):

function Badge({ count }: { count: number }) { return ( <div> {count > 0 ? <span className="badge">{count}</span> : null} </div> ) }

// When count = 0, renders: <div></div> // When count = 5, renders: <div><span class="badge">5</span></div>

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

fumadocs-mdx-structure

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

rendering-animate-svg

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

8-bit-pixel-art-patterns

No summary provided by upstream source.

Repository SourceNeeds Review