synstate-react-hooks-compat 3.0.6 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/create-boolean-state.d.mts +2 -2
- package/dist/create-boolean-state.d.mts.map +1 -1
- package/dist/create-boolean-state.mjs +2 -2
- package/dist/create-boolean-state.mjs.map +1 -1
- package/dist/create-reducer.d.mts +3 -3
- package/dist/create-reducer.d.mts.map +1 -1
- package/dist/create-reducer.mjs +2 -2
- package/dist/create-reducer.mjs.map +1 -1
- package/dist/create-state.d.mts +2 -2
- package/dist/create-state.d.mts.map +1 -1
- package/dist/create-state.mjs +2 -2
- package/dist/create-state.mjs.map +1 -1
- package/dist/use-observable-effect.d.mts +1 -1
- package/dist/use-observable-effect.d.mts.map +1 -1
- package/dist/use-observable-value.d.mts +1 -1
- package/dist/use-observable-value.d.mts.map +1 -1
- package/package.json +8 -8
- package/src/create-boolean-state.mts +4 -2
- package/src/create-reducer.mts +4 -1
- package/src/create-state.mts +3 -1
- package/src/use-observable-effect.mts +1 -1
- package/src/use-observable-value.mts +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ synstate-react-hooks-compat re-exports all exports from synstate except for `cre
|
|
|
4
4
|
|
|
5
5
|
The first element of the array returned by the `createState<T>` function provided by synstate-react-hooks-compat is changed from `InitializedObservable<T>` to a React hook `() => T`, and the `InitializedObservable<T>` has been moved to the `state` property in the object at index 2.
|
|
6
6
|
|
|
7
|
+
Their options, such as `equals` (the second argument of `createState` and `createBooleanState`, the third of `createReducer`), are passed to synstate as they are.
|
|
8
|
+
|
|
7
9
|
This package provides the same API as [synstate-react-hooks](https://www.npmjs.com/package/synstate-react-hooks), but subscribes to observables with `useState` + `useEffect` instead of `useSyncExternalStore`, so it also works with React 16.8 and 17. Use synstate-react-hooks if you are on React 18 or later.
|
|
8
10
|
|
|
9
11
|
## Installation
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type InitializedObservable } from 'synstate';
|
|
2
|
-
export declare const createBooleanState: (initialState: boolean) => readonly [useCurrentValue: () => boolean, utils: Readonly<{
|
|
1
|
+
import { type InitializedObservable, type StateOptions } from 'synstate';
|
|
2
|
+
export declare const createBooleanState: (initialState: boolean, options?: StateOptions<boolean>) => readonly [useCurrentValue: () => boolean, utils: Readonly<{
|
|
3
3
|
state: InitializedObservable<boolean>;
|
|
4
4
|
setTrue: () => void;
|
|
5
5
|
setFalse: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-boolean-state.d.mts","sourceRoot":"","sources":["../src/create-boolean-state.mts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-boolean-state.d.mts","sourceRoot":"","sources":["../src/create-boolean-state.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,kBAAkB,iBACf,OAAO,YACX,YAAY,CAAC,OAAO,CAAC,KAC9B,SAAS,CACV,eAAe,EAAE,MAAM,OAAO,EAC9B,KAAK,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IACrC,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,KAAK,OAAO,CAAC;IAC/D,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CA+BH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBooleanState as createBooleanStateBase, } from 'synstate';
|
|
2
2
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
3
|
-
export const createBooleanState = (initialState) => {
|
|
4
|
-
const [state, { setTrue, setFalse, setState, toggle, updateState, resetState, getSnapshot, },] = createBooleanStateBase(initialState);
|
|
3
|
+
export const createBooleanState = (initialState, options) => {
|
|
4
|
+
const [state, { setTrue, setFalse, setState, toggle, updateState, resetState, getSnapshot, },] = createBooleanStateBase(initialState, options);
|
|
5
5
|
const useCurrentValue = () => useObservableValue(state);
|
|
6
6
|
return [
|
|
7
7
|
useCurrentValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-boolean-state.mjs","sourceRoot":"","sources":["../src/create-boolean-state.mts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create-boolean-state.mjs","sourceRoot":"","sources":["../src/create-boolean-state.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,sBAAsB,GAG7C,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,YAAqB,EACrB,OAA+B,EAc/B,EAAE;IACF,MAAM,CACJ,KAAK,EACL,EACE,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,WAAW,EACX,UAAU,EACV,WAAW,GACZ,EACF,GAAG,sBAAsB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAElD,MAAM,eAAe,GAAG,GAAY,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEjE,OAAO;QACL,eAAe;QACf;YACE,KAAK;YACL,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,MAAM;YACN,WAAW;YACX,UAAU;YACV,WAAW;YACX,YAAY;SACb;KACO,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type InitializedObservable } from 'synstate';
|
|
2
|
-
import {
|
|
3
|
-
export declare const createReducer: <S, A>(reducer: Reducer<S, A>, initialState: S) => readonly [useCurrentValue: () => S, dispatch: (action: A) => S, utils: Readonly<{
|
|
1
|
+
import { type InitializedObservable, type StateOptions } from 'synstate';
|
|
2
|
+
import type { Reducer } from 'ts-type-forge';
|
|
3
|
+
export declare const createReducer: <S, A>(reducer: Reducer<S, A>, initialState: S, options?: StateOptions<NoInfer<S>>) => readonly [useCurrentValue: () => S, dispatch: (action: A) => S, utils: Readonly<{
|
|
4
4
|
state: InitializedObservable<S>;
|
|
5
5
|
getSnapshot: () => S;
|
|
6
6
|
initialState: S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reducer.d.mts","sourceRoot":"","sources":["../src/create-reducer.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"create-reducer.d.mts","sourceRoot":"","sources":["../src/create-reducer.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,WACvB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,gBACR,CAAC,YACL,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KACjC,SAAS,CACV,eAAe,EAAE,MAAM,CAAC,EACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAC1B,KAAK,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,YAAY,EAAE,CAAC,CAAC;CACjB,CAAC,CAWH,CAAC"}
|
package/dist/create-reducer.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createReducer as createReducerBase, } from 'synstate';
|
|
2
2
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
3
|
-
export const createReducer = (reducer, initialState) => {
|
|
4
|
-
const [state, dispatch, { getSnapshot }] = createReducerBase(reducer, initialState);
|
|
3
|
+
export const createReducer = (reducer, initialState, options) => {
|
|
4
|
+
const [state, dispatch, { getSnapshot }] = createReducerBase(reducer, initialState, options);
|
|
5
5
|
const useCurrentValue = () => useObservableValue(state);
|
|
6
6
|
return [useCurrentValue, dispatch, { state, getSnapshot, initialState }];
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reducer.mjs","sourceRoot":"","sources":["../src/create-reducer.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,iBAAiB,
|
|
1
|
+
{"version":3,"file":"create-reducer.mjs","sourceRoot":"","sources":["../src/create-reducer.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,iBAAiB,GAGnC,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,OAAsB,EACtB,YAAe,EACf,OAAkC,EASlC,EAAE;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,iBAAiB,CAC1D,OAAO,EACP,YAAY,EACZ,OAAO,CACR,CAAC;IAEF,MAAM,eAAe,GAAG,GAAM,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE3D,OAAO,CAAC,eAAe,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC"}
|
package/dist/create-state.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type InitializedObservable } from 'synstate';
|
|
2
|
-
export declare const createState: <S>(initialState: S) => readonly [useCurrentValue: () => S, setState: (v: S) => S, utils: Readonly<{
|
|
1
|
+
import { type InitializedObservable, type StateOptions } from 'synstate';
|
|
2
|
+
export declare const createState: <S>(initialState: S, options?: StateOptions<NoInfer<S>>) => readonly [useCurrentValue: () => S, setState: (v: S) => S, utils: Readonly<{
|
|
3
3
|
state: InitializedObservable<S>;
|
|
4
4
|
updateState: (updateFn: (prev: S) => S) => S;
|
|
5
5
|
resetState: () => S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-state.d.mts","sourceRoot":"","sources":["../src/create-state.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"create-state.d.mts","sourceRoot":"","sources":["../src/create-state.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,WAAW,GAAI,CAAC,gBACb,CAAC,YACL,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KACjC,SAAS,CACV,eAAe,EAAE,MAAM,CAAC,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EACrB,KAAK,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,YAAY,EAAE,CAAC,CAAC;CACjB,CAAC,CAkBH,CAAC"}
|
package/dist/create-state.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createState as createStateBase, } from 'synstate';
|
|
2
2
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
3
|
-
export const createState = (initialState) => {
|
|
4
|
-
const [state, setState, { updateState, resetState, getSnapshot }] = createStateBase(initialState);
|
|
3
|
+
export const createState = (initialState, options) => {
|
|
4
|
+
const [state, setState, { updateState, resetState, getSnapshot }] = createStateBase(initialState, options);
|
|
5
5
|
const useCurrentValue = () => useObservableValue(state);
|
|
6
6
|
return [
|
|
7
7
|
useCurrentValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-state.mjs","sourceRoot":"","sources":["../src/create-state.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"create-state.mjs","sourceRoot":"","sources":["../src/create-state.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,GAG/B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,YAAe,EACf,OAAkC,EAWlC,EAAE;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,GAC/D,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,GAAM,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE3D,OAAO;QACL,eAAe;QACf,QAAQ;QACR;YACE,KAAK;YACL,WAAW;YACX,UAAU;YACV,WAAW;YACX,YAAY;SACb;KACO,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-observable-effect.d.mts","sourceRoot":"","sources":["../src/use-observable-effect.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-observable-effect.d.mts","sourceRoot":"","sources":["../src/use-observable-effect.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,mBAAmB,GAAI,CAAC,eACtB,UAAU,CAAC,CAAC,CAAC,kBACV,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,KAC7B,IAQF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InitializedObservable, Observable } from 'synstate';
|
|
2
2
|
export declare function useObservableValue<A, B = A>(observable$: Observable<A>, initialValue: B): A | B;
|
|
3
3
|
export declare function useObservableValue<A>(observable$: InitializedObservable<A>): A;
|
|
4
4
|
export declare function useObservableValue<A>(observable$: Observable<A>): A | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-observable-value.d.mts","sourceRoot":"","sources":["../src/use-observable-value.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-observable-value.d.mts","sourceRoot":"","sources":["../src/use-observable-value.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGlE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EACzC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAC1B,YAAY,EAAE,CAAC,GACd,CAAC,GAAG,CAAC,CAAC;AAET,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEhF,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,GACzB,CAAC,GAAG,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "synstate-react-hooks-compat",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "SynState React hooks for React 16.8–17 (without useSyncExternalStore)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"LICENSE"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"synstate": "3.0
|
|
31
|
+
"synstate": "3.2.0",
|
|
32
32
|
"ts-data-forge": "^14.7.1",
|
|
33
33
|
"ts-type-forge": "^9.2.2"
|
|
34
34
|
},
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"@testing-library/react": "16.3.3",
|
|
38
38
|
"@types/react": "19.3.0",
|
|
39
39
|
"@types/react-dom": "19.3.0",
|
|
40
|
-
"@vitest/browser-playwright": "5.0.
|
|
41
|
-
"eslint-config-typed": "5.
|
|
42
|
-
"eslint-plugin-ts-data-forge": "0.8.
|
|
43
|
-
"eslint-plugin-ts-fortress": "1.
|
|
44
|
-
"eslint-plugin-ts-type-forge": "0.8.
|
|
40
|
+
"@vitest/browser-playwright": "5.0.3",
|
|
41
|
+
"eslint-config-typed": "5.17.1",
|
|
42
|
+
"eslint-plugin-ts-data-forge": "0.8.4",
|
|
43
|
+
"eslint-plugin-ts-fortress": "1.3.1",
|
|
44
|
+
"eslint-plugin-ts-type-forge": "0.8.6",
|
|
45
45
|
"playwright": "1.63.0",
|
|
46
|
-
"prettier": "3.9.
|
|
46
|
+
"prettier": "3.9.9",
|
|
47
47
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
48
48
|
"prettier-plugin-packagejson": "3.0.2",
|
|
49
49
|
"react": "19.3.0",
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type InitializedObservable,
|
|
3
2
|
createBooleanState as createBooleanStateBase,
|
|
3
|
+
type InitializedObservable,
|
|
4
|
+
type StateOptions,
|
|
4
5
|
} from 'synstate';
|
|
5
6
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
6
7
|
|
|
7
8
|
export const createBooleanState = (
|
|
8
9
|
initialState: boolean,
|
|
10
|
+
options?: StateOptions<boolean>,
|
|
9
11
|
): readonly [
|
|
10
12
|
useCurrentValue: () => boolean,
|
|
11
13
|
utils: Readonly<{
|
|
@@ -31,7 +33,7 @@ export const createBooleanState = (
|
|
|
31
33
|
resetState,
|
|
32
34
|
getSnapshot,
|
|
33
35
|
},
|
|
34
|
-
] = createBooleanStateBase(initialState);
|
|
36
|
+
] = createBooleanStateBase(initialState, options);
|
|
35
37
|
|
|
36
38
|
const useCurrentValue = (): boolean => useObservableValue(state);
|
|
37
39
|
|
package/src/create-reducer.mts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createReducer as createReducerBase,
|
|
3
3
|
type InitializedObservable,
|
|
4
|
+
type StateOptions,
|
|
4
5
|
} from 'synstate';
|
|
5
|
-
import {
|
|
6
|
+
import type { Reducer } from 'ts-type-forge';
|
|
6
7
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
7
8
|
|
|
8
9
|
export const createReducer = <S, A>(
|
|
9
10
|
reducer: Reducer<S, A>,
|
|
10
11
|
initialState: S,
|
|
12
|
+
options?: StateOptions<NoInfer<S>>,
|
|
11
13
|
): readonly [
|
|
12
14
|
useCurrentValue: () => S,
|
|
13
15
|
dispatch: (action: A) => S,
|
|
@@ -20,6 +22,7 @@ export const createReducer = <S, A>(
|
|
|
20
22
|
const [state, dispatch, { getSnapshot }] = createReducerBase(
|
|
21
23
|
reducer,
|
|
22
24
|
initialState,
|
|
25
|
+
options,
|
|
23
26
|
);
|
|
24
27
|
|
|
25
28
|
const useCurrentValue = (): S => useObservableValue(state);
|
package/src/create-state.mts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createState as createStateBase,
|
|
3
3
|
type InitializedObservable,
|
|
4
|
+
type StateOptions,
|
|
4
5
|
} from 'synstate';
|
|
5
6
|
import { useObservableValue } from './use-observable-value.mjs';
|
|
6
7
|
|
|
7
8
|
export const createState = <S,>(
|
|
8
9
|
initialState: S,
|
|
10
|
+
options?: StateOptions<NoInfer<S>>,
|
|
9
11
|
): readonly [
|
|
10
12
|
useCurrentValue: () => S,
|
|
11
13
|
setState: (v: S) => S,
|
|
@@ -18,7 +20,7 @@ export const createState = <S,>(
|
|
|
18
20
|
}>,
|
|
19
21
|
] => {
|
|
20
22
|
const [state, setState, { updateState, resetState, getSnapshot }] =
|
|
21
|
-
createStateBase(initialState);
|
|
23
|
+
createStateBase(initialState, options);
|
|
22
24
|
|
|
23
25
|
const useCurrentValue = (): S => useObservableValue(state);
|
|
24
26
|
|