-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support React Suspense #6
Comments
Haven’t worked with |
I've been messing with it the last few nights - I'll throw up a PR soon with some Suspense stuff. |
Hell ya |
So this is the API I'm toying with (and an example implementation): const Example = () => {
const { data, error } = useFetch('https://example.com', { suspense: true });
if (error) {
return <div>{error}</div>;
}
return <div>{data}</div>;
};
const App = () => (
<React.Suspense fallback={'Loading...'}>
<Example />
</React.Suspense>
); We could also just make separate hooks, but my thought is that it may be better to have it as an option on each hook, otherwise we'd have to make a corresponding suspense-ready hook for each regular hook (e.g. Thoughts? cc: @bvalosek |
Damn, that’s pretty sick. Def wanna explore that |
Will leave this issue open for now - let's use this to drop any relevant thoughts and implementation ideas as data fetching with Suspense matures. |
No description provided.
The text was updated successfully, but these errors were encountered: