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
const store =newStore(recordSource, persistOptionsStore);
218
+
const store =newStore(recordSource, persistOptionsStore, relayStoreOptions);
218
219
const environment =newEnvironment({ network, store });
219
220
```
220
221
221
-
## QueryRenderer
222
222
223
-
- Add "cached" property in render function
224
-
- Add "ttl" property in order to change default ttl in store
225
-
-`fetchPolicy` determine whether it should use data cached in the Relay store and whether to send a network request. The options are:
226
-
-`store-or-network` (default): Reuse data cached in the store; if the whole query is cached, skip the network request
227
-
-`store-and-network`: Reuse data cached in the store; always send a network request.
228
-
-`network-only`: Don't reuse data cached in the store; always send a network request. (This is the default behavior of Relay's existing `QueryRenderer`.)
229
-
-`store-only`: Reuse data cached in the store; never send a network request.
`useQuery` does not take an environment as an argument. Instead, it reads the environment set in the context; this also implies that it does not set any React context.
226
+
In addition to `query` (first argument) and `variables` (second argument), `useQuery` accepts a third argument `options`.
242
227
243
-
## useQuery
228
+
**options**
229
+
230
+
`fetchPolicy`: determine whether it should use data cached in the Relay store and whether to send a network request. The options are:
231
+
*`store-or-network` (default): Reuse data cached in the store; if the whole query is cached, skip the network request
232
+
*`store-and-network`: Reuse data cached in the store; always send a network request.
233
+
*`network-only`: Don't reuse data cached in the store; always send a network request. (This is the default behavior of Relay's existing `QueryRenderer`.)
234
+
*`store-only`: Reuse data cached in the store; never send a network request.
235
+
236
+
`fetchKey`: [Optional] A fetchKey can be passed to force a refetch of the current query and variables when the component re-renders, even if the variables didn't change, or even if the component isn't remounted (similarly to how passing a different key to a React component will cause it to remount). If the fetchKey is different from the one used in the previous render, the current query and variables will be refetched.
237
+
238
+
`networkCacheConfig`: [Optional] Object containing cache config options for the network layer. Note the the network layer may contain an additional query response cache which will reuse network responses for identical queries. If you want to bypass this cache completely, pass {force: true} as the value for this option. **Added the TTL property to configure a specific ttl for the query.**
239
+
240
+
`skip`: [Optional] If skip is true, the query will be skipped entirely.
241
+
242
+
`onComplete`: [Optional] Function that will be called whenever the fetch request has completed
0 commit comments