3 ms·
Handling loading states also seems to be a little bit on the anemic side, but I didn't investigate too deeply.
by occz 5y ago
Handling 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.