createVanilla

Tip

In Vanilla scenarios, please import all APIs from /vanilla to avoid errors due to dependencies on React without it being installed.

Create a Store without Hooks properties, suitable for Vanilla JS applications. It includes built-in enhancers withSubscribe and withSnapshot.

Tip

Before version v0.2.0, the Vanilla part of createVanilla was known as create. To avoid confusion with the React part's create, it was renamed to createVanilla starting from version v0.2.0.

import { createVanilla } from '@shined/reactive';

const vanillaStore = createVanilla({ count: 0});

// vanillaStore.mutate
// vanillaStore.restore()

// vanillaStore.snapshot()
// vanillaStore.subscribe()

Store Mutate

Identical to store.mutate in create.

Store Snapshot

Identical to store.snapshot in create, supported by withSnapshot.

Store Subscribe

Identical to store.subscribe in create, supported by withSubscribe.

Store Restore

Identical to store.restore in create.