UNPKG

@hanamura/react-containers

Version:
15 lines (14 loc) 475 B
/** * Creates a resource that can be used with React's Suspense * Pattern inspired by React docs and community practices */ export declare function createResource<T>(asyncFn: () => Promise<T>): { read: () => T; }; /** * Creates a resource for browser-only features that will resolve immediately on the client * but will suspense on the server, allowing for a clean hydration */ export declare function createBrowserResource<T>(fn: () => T): { read: () => T; };