Skip to content

Commit

Permalink
#: Upgrade version to 4.0.36-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
zdu-strong committed Jun 22, 2024
1 parent cf0aa21 commit f2721b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/js/useMobxState.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { remove, runInAction, observable } from 'mobx';
import { remove, runInAction, makeAutoObservable } from 'mobx';
import { useRef, useState } from 'react';

export function useMobxState<T extends Record<any, any>>(state: T | (() => T)): T;
export function useMobxState<T extends Record<any, any>, P extends Record<any, any>>(state: T | (() => T), props: P): T & P;

export function useMobxState<T extends Record<any, any>, P extends Record<any, any>>(state: T | (() => T), props?: P): T & P {
const initStateFunction = typeof state === "function" ? (state as any) : () => state;
const mobxState = useState(() => observable(initStateFunction(), undefined, { autoBind: true, proxy: false }))[0] as Record<string, any>;
const mobxState = useState(() => makeAutoObservable(initStateFunction()))[0] as Record<string, any>;

const keyListOfState = useRef<string[]>([]);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-react-use-autorun",
"version": "4.0.35",
"version": "4.0.36-beta",
"description": "Provide concise usage for mobx in react",
"scripts": {
"test": "npx -y -p typescript -p ts-node ts-node --skipProject bin/mobx_react_test.ts",
Expand Down

0 comments on commit f2721b7

Please sign in to comment.