Skip to content

Commit f6133aa

Browse files
authored
Merge pull request #432 from itsdouges/triplex/expose-xr-store-safe
Add safe access XR store hook
2 parents c54f514 + 686b277 commit f6133aa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react/xr/src/xr.tsx

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

147+
/**
148+
* Returns the XR store object from a parent {@link XR} component. If no component is found `undefined` is returned.
149+
* You most likely should be using {@link useXRStore} instead.
150+
*/
151+
export function UNSAFE_useXRStore() {
152+
const store = useContext(xrContext)
153+
return store
154+
}
155+
147156
/**
148157
* Hook for reading the state from the xr store
149158
*/

0 commit comments

Comments
 (0)