Getting Started
First, install:
sh
npm i -s rxjs
npm i -s @state-adapt/core
npm i -s @state-adapt/rxjs
Create a file named state-adapt.ts
and export watch
and adapt
:
ts
import { actionSanitizer, stateSanitizer } from '@state-adapt/core';
import { configureStateAdapt } from '@state-adapt/rxjs';
const enableReduxDevTools = (window as any).__REDUX_DEVTOOLS_EXTENSION__?.({
actionSanitizer,
stateSanitizer,
});
export const { adapt, watch } = configureStateAdapt({
devtools: enableReduxDevTools,
});
And now you can use it in your components:
ts
import { adapt } from '../state-adapt';
const nameStore = adapt('Bob');
const name$ = nameStore.state$;
const name = $name$;
Library Coming Soon
StateAdapt doesn't currently have a dedicated library for Svelte, but it will.
For now, refer to configureStateAdapt
for options.
Runes
We are considering two options to add support for runes. Please check progress here and chime in with feedback.