threlte logo
@threlte/xr

useXR

Provides context about the current WebXR session.

<script>
  import { useXR } from '@threlte/xr'

  const { isPresenting, isHandTracking, session, xrFrame } = useXR()
</script>

Signature

const {
  isPresenting, // CurrentWritable<boolean> - Whether the XR device is presenting in an XR session
  isHandTracking, // CurrentWritable<boolean> - Whether hand tracking inputs are active
  session, // CurrentWritable<XRSession | undefined> - The active `XRSession`
  xrFrame // CurrentWritable<XRFrame> - The current XRFrame
} = useXR()