File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ npm install react-query-grpc-gateway
19
19
20
20
## Usage
21
21
22
+ - [ useServiceQuery] ( #useservicequery )
23
+ - [ useServiceMutation] ( #useservicemutation )
24
+ - [ queryOptions] ( #queryoptions )
25
+
26
+ ### useServiceQuery
27
+
22
28
` useServiceQuery ` is a drop in replacement for ` useQuery ` that allows for the propagation of request configuration through the context.
23
29
24
30
Assuming you have a proto definition for a ` UserService ` with a ` ReadUser `
@@ -91,6 +97,21 @@ The arguments for `useServiceQuery` are:
91
97
` onError ` can be used to customize error handling behavior at the request level,
92
98
for example, don't even show React Query that a 401 occurred.
93
99
100
+ ### useServiceMutation
101
+
102
+ ` useServiceMutation ` is a drop in replacement for ` useMutation ` .
103
+
104
+ ``` ts
105
+ const mutation = useServiceMutation (UserService .UpdateUser , {});
106
+ mutation .mutate ({ id: userID , name: newName });
107
+ ```
108
+
109
+ ### queryOptions
110
+
111
+ ` queryOptions ` can be used for consistency if you need to prefetch queries or
112
+ use suspenses. It is only marginally more convenient than using the service
113
+ method directly.
114
+
94
115
## Contributing
95
116
96
117
If you find issues or spot possible improvements, please submit a pull-request.
You can’t perform that action at this time.
0 commit comments