From a001ac5aa0d5e42ab7d220e25102c530b0e22a6c Mon Sep 17 00:00:00 2001 From: Ugurcan Emre Atas Date: Mon, 21 Oct 2024 18:05:19 +0200 Subject: [PATCH 1/2] chore(docs): update react native useQueryFocusAware docs --- docs/framework/react/react-native.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/framework/react/react-native.md b/docs/framework/react/react-native.md index 2c2d6fc0e2..aa0e653c37 100644 --- a/docs/framework/react/react-native.md +++ b/docs/framework/react/react-native.md @@ -167,10 +167,21 @@ export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) { return () => focusedRef.current - useQuery({ +} +``` + +Example usage: + +```tsx +function MyComponent() { + const isFocused = useQueryFocusAware() + + const { dataUpdatedAt } = useQuery({ queryKey: ['key'], queryFn: () => fetch(...), - enabled: () => focusedRef.current, + enabled: isFocused, }) + + return DataUpdatedAt: {dataUpdatedAt} } ``` From ba541892ffd9c5e19fe267a69e826ed26140e37c Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:01:06 +0000 Subject: [PATCH 2/2] ci: apply automated fixes --- docs/framework/react/react-native.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/framework/react/react-native.md b/docs/framework/react/react-native.md index aa0e653c37..a7ca5d18ca 100644 --- a/docs/framework/react/react-native.md +++ b/docs/framework/react/react-native.md @@ -166,7 +166,6 @@ export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) { ) return () => focusedRef.current - } ```