Skip to content

@shtse8/fluxus v1.0.0


@shtse8/fluxus / react-adapter / ProviderScope

Function: ProviderScope()

ProviderScope(props): ReactElement

Defined in: react-adapter/ProviderScope.tsx:40

A React component that creates and manages a Fluxus Scope instance and provides it to descendant components via React Context.

This is the entry point for using Fluxus providers within a React application tree. It ensures that a stable scope is available and handles the automatic disposal of the scope and its associated provider states when the component unmounts.

Scopes can be nested by nesting ProviderScope components.

Parameters

props

ProviderScopeProps

The component props.

Returns

ReactElement

The provider component wrapping the children.

Example

tsx
ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <ProviderScope>
      <App />
    </ProviderScope>
  </React.StrictMode>,
)

Released under the ISC License.