@statesync/redux
@statesync/redux
@statesync/redux — Redux adapter for the state-sync revision-based synchronization engine.
This package provides two approaches for applying snapshots to a Redux store:
- withSnapshotHandling — a higher-order function that wraps your reducer to automatically handle snapshot actions (zero-config).
- snapshotApplied action creator + SNAPSHOT_ACTION_TYPE — for manual handling in RTK
extraReducersor custom reducers.
Both work together via createReduxSnapshotApplier, which creates a standard SnapshotApplier that dispatches snapshot actions to the store.
Example
ts
import { configureStore } from '@reduxjs/toolkit';
import { createReduxSnapshotApplier, withSnapshotHandling } from '@statesync/redux';
const store = configureStore({
reducer: withSnapshotHandling(rootReducer),
});
const applier = createReduxSnapshotApplier(store);