Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: react
uxrenderingfallback
Provide a fallback for missing display text instead of rendering stray punctuation
When optional text is absent, render a fallback or omit the surrounding markup so you don't show dangling separators/question marks.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | <span>{ticker?.name}?</span> // shows a lonely "?" when name is missing |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | {ticker?.name && <span>{ticker.name}</span>} |
| 2 | // or: const title = article.title || 'Tittel mangler'; |
Explanation (EN)
Objašnjenje (HR)