diff --git a/docs/framework/react/react-native.md b/docs/framework/react/react-native.md index 2c2d6fc0e2..a7ca5d18ca 100644 --- a/docs/framework/react/react-native.md +++ b/docs/framework/react/react-native.md @@ -166,11 +166,21 @@ export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) { ) return () => focusedRef.current +} +``` + +Example usage: + +```tsx +function MyComponent() { + const isFocused = useQueryFocusAware() - useQuery({ + const { dataUpdatedAt } = useQuery({ queryKey: ['key'], queryFn: () => fetch(...), - enabled: () => focusedRef.current, + enabled: isFocused, }) + + return DataUpdatedAt: {dataUpdatedAt} } ```