Skip to content

API reference > @kontsedal/olas-react > OlasProvider

OlasProvider() function ​

Provides an Olas root to descendant components. The root is created once (typically in main.tsx) and passed through here so React doesn't own the controller's lifetime — the adapter only reads. See spec §16.

Signature:

typescript
export declare function OlasProvider(props: OlasProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<Root<unknown> | null>>;

Parameters ​

Parameter

Type

Description

props

OlasProviderProps

Returns:

import("react").FunctionComponentElement<import("react").ProviderProps<Root<unknown> | null>>

Example ​

tsx
const root = createRoot(app, { deps, queries: queryEngine() })

export const Main = () => (
  <OlasProvider root={root}>
    <App />
  </OlasProvider>
)

Released under the MIT License.