Skip to content

Commit 59dbeb2

Browse files
committed
feat: add safe xr hook
1 parent c54f514 commit 59dbeb2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/react/xr/src/xr.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ export function useXRStore() {
144144
return store
145145
}
146146

147+
/**
148+
* Hook for getting the xr store from context. If not available `undefined` is returned.
149+
*/
150+
export function useXRStoreSafe() {
151+
const store = useContext(xrContext)
152+
return store
153+
}
154+
147155
/**
148156
* Hook for reading the state from the xr store
149157
*/

0 commit comments

Comments
 (0)