You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,29 @@ const query = new MobxQuery({
54
54
query.result.data; // from this code line query starts fetching data
55
55
```
56
56
57
+
This option works as is if query will be "enabled", otherwise you should enable this query.
58
+
```ts
59
+
const query =newMobxQuery({
60
+
enabled: false,
61
+
enableOnDemand: true,
62
+
queryFn: () => {},
63
+
});
64
+
query.result.data; // nothing happened because query is disabled.
65
+
```
66
+
But if you set `enabled` as `true` and option `enableOnDemand` will be `true` too then query will be fetched only after user will try to get access to result.
67
+
```ts
68
+
const query =newMobxQuery({
69
+
enabled: true,
70
+
enableOnDemand: true,
71
+
queryFn: () => {},
72
+
});
73
+
...
74
+
// query is not fetched
75
+
...
76
+
// query is not fetched
77
+
query.result.data; // query starts execute the queryFn
78
+
```
79
+
57
80
#### dynamic `options`
58
81
Options which can be dynamically updated for this query
0 commit comments