@jeswr/react-lazy-render
v1.0.1
Published
Lazy rendering for asynchronous React components
Downloads
6
Readme
react-lazy-render
Lazy rendering for asynchronous React components.
Usage
import LazyFactory from '@jeswr/react-lazy-renderer'
const LazyTextDisplay = LazyFactory<{ text: Promise<string> | string }>(
async ({ text }) => {
const resolvedText = `${await text}`;
return <>{resolvedText}</>;
},
);
function App() {
return <LazyTextDisplay text={Promise.resolve('Foo')} />;
}
License
©2021–present Jesse Wright, MIT License.