ilokesto

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:

  • pipe composes middleware around plain initial state and returns a Store.
  • adaptor wraps Immer's produce() 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 pipe when store setup is becoming too nested.
  • Use adaptor when object updates are becoming too verbose.
  • Stay with plain create() when the base API is already readable enough.
  • 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.

On this page