Documents / @faasjs/react
@faasjs/react
React plugin for FaasJS.
If you use SWR or React Query / TanStack Query, please use @faasjs/browser
directly.
Features
- Support FaasJS Request Specifications.
- Support global and per-request configurations.
- Support React Server Actions.
- Compatible with why-did-you-render.
- Additional React functions:
- Utils:
- equal: Compare two values for deep equality.
- useEqualMemoize: Memoize a value with deep equality.
- useEqualEffect: Run an effect with deep equality.
- useEqualMemo: Memoize a value with deep equality.
- useEqualCallback: Memoize a callback with deep equality.
- useConstant: Create a constant value with hooks.
- createSplittingContext: Create a context for code splitting.
- OptionalWrapper: Render a component optionally.
- ErrorBoundary: Catch errors in the component tree.
- Fetch Data:
- faas: Fetch data from FaasJS.
- useFaas: Fetch data from FaasJS with hooks.
- FaasDataWrapper: Fetch data from FaasJS with a wrapper component.
- withFaasData: Fetch data from FaasJS using a higher-order component (HOC).
- Utils:
Install
npm install @faasjs/react
Functions
- createSplittingContext
- equal
- faas
- FaasDataWrapper
- FaasReactClient
- getClient
- OptionalWrapper
- useConstant
- useEqualCallback
- useEqualEffect
- useEqualMemo
- useEqualMemoize
- useFaas
- withFaasData