Relay Flashcards

1
Q

useQueryLoader

A

Hook used to make it easy to safely load and retain queries. It will keep a query reference stored in state, and dispose of it when the component is disposed or it is no longer accessible via state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does useQueryLoader return?

A
and array of: [
 queryReference,
 loadQuery,
 disposeQuery
]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are the arguments useQueryLoader accepts?

A

query: GraphQL query specified using a graphql template literal.

initialQueryRef: [Optional] An initial PreloadedQuery to be used as the initial value of the queryReference stored in state and returned by useQueryLoader.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is queryReference in the return of useQueryLoader?

A

the query reference, or null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is loadQuery in the return of useQueryLoader?

A

a callback that, when executed, will load a query, which will be accessible as queryReference. If a previous query was loaded, it will dispose of it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is disposeQuery in the return of useQueryLoader?

A

a callback that, when executed, will set queryReference to null and call .dispose() on it. It has type () => void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly