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
reactanchornavigationsemantics
Don't mix a real href with a JS-navigation onClick on the same anchor
An anchor that both has an href and an onClick that opens/navigates does the work twice; either use a button with the click handler or a plain link with no handler.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | <li onClick={() => window.open(url)}> |
| 2 | <a href={tickerUrl} onClick={stopPropagation}>{ticker}</a> |
| 3 | </li> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | <li> |
| 2 | <a href={url}>{title}</a> |
| 3 | <a href={tickerUrl}>{ticker}</a> |
| 4 | </li> |
Explanation (EN)
Objašnjenje (HR)