122 ms·
How do you deal with error handling? I don't see anything in the docs about error handling. How do you deal with union types? The docs seem completely scant on
by a_humean 5y ago
How do you deal with error handling? I don't see anything in the docs about error handling.
How do you deal with union types? The docs seem completely scant on that.
Otherwise very interesting approach.
- occz 5y agoHandling loading states also seems to be a little bit on the anemic side, but I didn't investigate too deeply.
- a_humean 5y agoYes, it doesn't really distinguish between loading vs null values in any of the examples. My guess is its going to be something like `undefined` means loading and `null` means null.
- nwienert 5y agoThere’s a different hook you can use that returns an error state.
- merrywhether 5y agoThe primary example code relies on Suspense, meaning that loading behavior will be handled by a parent/ancestor <Suspense /> component and not in the component itself. I think they default to showing this pattern since it is the “future” of React. There is an alternate version of the API where you can get a loading boolean for imperative control.
- merrywhether 5y agoThe useQuery hook’s opts have an onError property that accepts a callback. I also don’t see anything about union types. That definitely seems like the hardest thing to reverse construct based on usage, since the underlying proxy wouldn’t know what you’re doing with __typename.