@coaction/valtio
v4.0.0
Published
A Coaction integration tool for Valtio
Readme
@coaction/valtio
A Coaction integration tool for Valtio.
Installation
Install it with pnpm:
pnpm add coaction @coaction/valtio valtioUsage
import { create } from 'coaction';
import { adapt, bindValtio, proxy } from '@coaction/valtio';
const state = proxy(
bindValtio({
count: 0,
increment() {
this.count += 1;
}
})
);
const store = create(() => adapt(state));
store.getState().increment();Limitations
@coaction/valtioonly supports binding a whole Valtio store.- Coaction
Slicesmode is not supported in this adapter. - Shared main/client mode is supported for Coaction method execution; direct writes to mirrored schema fields on the client-side Valtio proxy are restored to the authoritative snapshot.
- Unknown root properties written directly to the Valtio proxy are ignored by Coaction's fixed schema. They are not promoted into Coaction raw/public state, and this adapter does not guarantee pruning them from the Valtio proxy.
Documentation
You can find the documentation here.
