Giter Club home page Giter Club logo

react's Introduction

MIT License PRs Welcome Commitizen friendly

codecov GitHub stars GitHub forks



npm version npm npm bundle size

All declarative components to use suspense on both CSR, SSR.

Features

  • Suspense, withSuspense (containing CSROnly)
  • ErrorBoundary, withErrorBoundary, useErrorBoundary
  • ErrorBoundaryGroup, withErrorBoundaryGroup, useErrorBoundaryGroup
  • AsyncBoundary, withAsyncBoundary (containing CSROnly)
  • Delay, withDelay
  • SuspensiveProvider, Suspensive
  • Await, useAwait, awaitClient (Experimental)

Installation

npm install @suspensive/react
pnpm add @suspensive/react
yarn add @suspensive/react

Usage

import { Suspense, ErrorBoundary, ErrorBoundaryGroup, Delay } from '@suspensive/react'

const Example = () => (
  <ErrorBoundaryGroup>
    <ErrorBoundaryGroup.Reset trigger={(group) => <button onClick={group.reset}>Reset All</button>} />
    <ErrorBoundary
      fallback={(props) => (
        <>
          <button onClick={props.reset}>Try again</button>
          {props.error.message}
        </>
      )}
    >
      <Suspense
        fallback={
          <Delay>
            <Spinner />
          </Delay>
        }
      >
        <SuspendedComponent />
      </Suspense>
    </ErrorBoundary>
  </ErrorBoundaryGroup>
)


npm version npm npm bundle size

Declarative apis to use @tanstack/react-query with suspense easily.

Features

  • useSuspenseQuery
  • useSuspenseQueries
  • useSuspenseInfiniteQuery
  • QueryErrorBoundary, QueryAsyncBoundary

Installation

npm install @suspensive/react-query
pnpm add @suspensive/react-query
yarn add @suspensive/react-query

Usage

import { Suspense } from '@suspensive/react'
import { QueryErrorBoundary, useSuspenseQuery } from '@suspensive/react-query'

const Example = () => (
  <QueryErrorBoundary
    fallback={(props) => (
      <>
        <button onClick={props.reset}>Try again</button>
        {props.error.message}
      </>
    )}
  >
    <Suspense fallback={<Spinner />}>
      <SuspendedComponent />
    </Suspense>
  </QueryErrorBoundary>
)

const SuspendedComponent = () => {
  const query = useSuspenseQuery({
    queryKey,
    queryFn,
  })

  return <>{query.data}</>
}

Docs deployment

We provide Official Docs

See OFFICIAL DOCS


Visualization deployment

Concepts Visualization ready. You can see core concepts of Suspensive visually

See VISUALIZATION.


License

MIT © Suspensive. See LICENSE for details.

react's People

Contributors

manudeli avatar github-actions[bot] avatar okinawaa avatar tooooo1 avatar codebutler avatar dependabot[bot] avatar sukvvon avatar jinn2u avatar minsoo-web avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.