client-suspense
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

client-suspense GitHub license BundlePhobia

ClientSuspense component (client-only Suspense)

A component that suspends only on the client side.

Usage

For example, if you use nextjs with streaming related APIs, Suspense will be suspended on the server side. To avoid this you can use ClientSuspense like this:

import { ClientSuspense } from 'client-suspense';

export const App = () => {
  return (
    <div>
      <ClientSuspense
        fallback={(
          <Spinner />
        )}
      >
        <OtherComponent />
      </ClientSuspense>
    </div>
  );
};

And that's all it takes!

Installation

Recommend to use yarn for dependency management:

yarn add client-suspense

License

client-suspense is MIT licensed.

Package Sidebar

Install

npm i client-suspense

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.5 kB

Total Files

6

Last publish

Collaborators

  • eolme