Skip to content

jeswr/react-lazy-render

Repository files navigation

react-lazy-render

Lazy rendering for asynchronous React components.

GitHub license npm version build Dependabot semantic-release

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.

About

Lazily rendering for asynchronous React components

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published