API reference

SpatialSceneProvider Component

Establishes the lifecycle boundary for a spatial scene system. Wrap the spatial portion of the app once and pass an initializer returned by the package that implements the scene system. The provider initializes that system, exposes its availability through useSpatialScene, and disposes its resources when the provider unmounts. Scene-system-specific behavior belongs to the initializer and the descendant APIs, not to this provider. On platforms where the selected scene system is unavailable, useSpatialScene reports false. The provider continues rendering its children so each scene system can define its own fallback behavior.
import {
  SpatialSceneProvider,
  type SpatialSceneInitializer,
} from '@metavr/layout-compat';

function SpatialExperience({
  initializer,
}: {
  initializer: SpatialSceneInitializer;
}) {
  return (
    <SpatialSceneProvider initializer={initializer}>
      <App />
    </SpatialSceneProvider>
  );
}

Signature

SpatialSceneProvider(props: SpatialSceneProviderProps): React.ReactNode

Parameters

Returns

React.ReactNode