1 | import { useDeprecated } from "./utils/utils";
|
2 | import { observable, runInAction } from "mobx";
|
3 | import { useState } from "react";
|
4 | export function useAsObservableSource(current) {
|
5 | if ("production" !== process.env.NODE_ENV)
|
6 | useDeprecated("[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.");
|
7 |
|
8 |
|
9 |
|
10 | var res = useState(function () { return observable(current, {}, { deep: false }); })[0];
|
11 | runInAction(function () {
|
12 | Object.assign(res, current);
|
13 | });
|
14 | return res;
|
15 | }
|
16 |
|
\ | No newline at end of file |