@hanamura/react-containers
Version:
Flexible container components for React
15 lines (14 loc) • 475 B
TypeScript
/**
* 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;
};