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
reacteventsguard-clauses
Don't fire a handler with empty arguments when there is no data
If an action only makes sense with data, don't invoke its handler with null/undefined placeholders; gate the call so it only runs when the data exists.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetsx
| 1 | <Cell onClick={() => handleTickerChange(null, undefined)} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Cell onClick={ticker ? () => handleTickerChange(ticker.id, ticker.fullname) : undefined} /> |
Explanation (EN)
Objašnjenje (HR)