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 ruleP1universalStack: React
htmlsemanticsreactlistskeys
Put the anchor inside the list item, not wrapping it
<a> is not permitted as a direct child of <ul>/<ol>; nest the <a> inside each <li>. Also drop the key from inner elements - it belongs only on the outermost mapped element.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | {items.map(i => ( |
| 2 | <a key={i.id} href={i.url}> |
| 3 | <li key={i.id}>{i.title}</li> |
| 4 | </a> |
| 5 | ))} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | {items.map(i => ( |
| 2 | <li key={i.id}> |
| 3 | <a href={i.url}>{i.title}</a> |
| 4 | </li> |
| 5 | ))} |
Explanation (EN)
Objašnjenje (HR)