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: javascript
localstorageserializationapi-usage
Use the matching serialize/deserialize storage helpers for objects
When a storage wrapper offers object-aware methods (setObject/getObject), use them instead of manually JSON.stringify-ing into the string API.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codejavascript
| 1 | reactLocalStorage.set(key, JSON.stringify(order)); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | reactLocalStorage.setObject(key, order); |
Explanation (EN)
Objašnjenje (HR)