- Add 8 new skills (62 total, up from 58) - Official Anthropic skills: docx, pdf, pptx, xlsx, brand-guidelines, internal-comms - Vercel Labs skills: react-best-practices, web-design-guidelines - Implement dual-versioning: -official/-anthropic and -community suffixes - Update README with new skill registry and credits - Regenerate skills_index.json (62 skills validated) - Add comprehensive walkthrough.md BREAKING CHANGE: Document skills (docx/pdf/pptx/xlsx) renamed with version suffixes
980 B
980 B
title, impact, impactDescription, tags
| title | impact | impactDescription | tags |
|---|---|---|---|
| Use Explicit Conditional Rendering | LOW | prevents rendering 0 or NaN | rendering, conditional, jsx, falsy-values |
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>