immutability
Installation
SKILL.md
Immutability
Overview
Never mutate. Always return new objects.
Mutation causes bugs that are hard to track - when objects change unexpectedly, debugging becomes a nightmare. Immutability makes state changes explicit and predictable.
When to Use
- Modifying objects or arrays
- Updating state in React/Redux
- Function receives object as parameter
- Data shared between multiple parts of code