1 | var __read = (this && this.__read) || function (o, n) {
|
2 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3 | if (!m) return o;
|
4 | var i = m.call(o), r, ar = [], e;
|
5 | try {
|
6 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
7 | }
|
8 | catch (error) { e = { error: error }; }
|
9 | finally {
|
10 | try {
|
11 | if (r && !r.done && (m = i["return"])) m.call(i);
|
12 | }
|
13 | finally { if (e) throw e.error; }
|
14 | }
|
15 | return ar;
|
16 | };
|
17 | import { useDeprecated } from "./utils/utils";
|
18 | import { observable, runInAction } from "mobx";
|
19 | import { useState } from "react";
|
20 | export function useAsObservableSource(current) {
|
21 | if ("production" !== process.env.NODE_ENV)
|
22 | 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.");
|
23 | var _a = __read(useState(function () { return observable(current, {}, { deep: false }); }), 1), res = _a[0];
|
24 | runInAction(function () {
|
25 | Object.assign(res, current);
|
26 | });
|
27 | return res;
|
28 | }
|
29 |
|
\ | No newline at end of file |