YoltraDecoration<R extends string, S extends Record<R, any>, EM extends EventMapBase>
interfaceThe chainable decoration surface on a Yoltra.
Yoltra extends this, so every hook set is chainable.
Every method returns a **new hook set bound to the same context object**, re-typed. The
context is never recreated, so a StoreProvider from any view in the chain serves the
hooks of every other, and the Suspense cache is shared - it keys on store identity through
a WeakMap, and the widened store is the same object.
Call these at **module scope, once, before first render**. createHooks allocates fresh
function objects per call, so decorating inside a component would hand React a different
hook set on every render.Type parameters
| Name | Type | Description |
|---|---|---|
R | extends string | |
S | extends Record<R, any> | |
EM | extends EventMapBase |
Methods
withEffect
Registers an effect and returns a Yoltra widened by whatever event map it declares.
withMiddleware
Registers middleware and returns a Yoltra widened by whatever event map it declares.
Only the spec form can widen; a bare MiddlewareFunction contributes nothing, because
its event parameter is EventUnion<EM> and TypeScript cannot infer EM back out of it.
withSlice
Mounts a slice and returns a widened Yoltra: the same store, a new hook set.