1 | import { observable } from "mobx";
|
2 | import { useState } from "react";
|
3 | import { useDeprecated } from "./utils/utils";
|
4 | import { useAsObservableSource } from "./useAsObservableSource";
|
5 | export function useLocalStore(initializer, current) {
|
6 | if ("production" !== process.env.NODE_ENV) {
|
7 | useDeprecated("[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.");
|
8 | }
|
9 | var source = current && useAsObservableSource(current);
|
10 | return useState(function () { return observable(initializer(source), undefined, { autoBind: true }); })[0];
|
11 | }
|
12 |
|
\ | No newline at end of file |