Utilities
Utility helpers for store composition and object updates.
Utilities
@ilokesto/state/utils is where the package puts small helpers that improve ergonomics without changing the main create() API.
Right now that means two different kinds of help:
pipecomposes middleware around plain initial state and returns aStore.adaptorwraps Immer'sproduce()so you can write draft-style object updates.
When to reach for utilities
Reach for utils when the problem is ergonomic rather than architectural.
- Use
pipewhen store setup is becoming too nested. - Use
adaptorwhen object updates are becoming too verbose. - Stay with plain
create()when the base API is already readable enough.
Related APIs
create: Main entry point for React integration.middleware: Built-in middleware for common tasks.
Read pipe if your store setup is the problem. Read adaptor if object update syntax is the problem.