Skip to content

Commit caf6556

Browse files
ugurcanatasTkDodoautofix-ci[bot]
authored
chore(docs): update useQueryFocusAware docs (#8205)
* chore(docs): update react native useQueryFocusAware docs * ci: apply automated fixes --------- Co-authored-by: Dominik Dorfmeister <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 820bb81 commit caf6556

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/framework/react/react-native.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,21 @@ export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) {
166166
)
167167

168168
return () => focusedRef.current
169+
}
170+
```
171+
172+
Example usage:
173+
174+
```tsx
175+
function MyComponent() {
176+
const isFocused = useQueryFocusAware()
169177

170-
useQuery({
178+
const { dataUpdatedAt } = useQuery({
171179
queryKey: ['key'],
172180
queryFn: () => fetch(...),
173-
enabled: () => focusedRef.current,
181+
enabled: isFocused,
174182
})
183+
184+
return <Text>DataUpdatedAt: {dataUpdatedAt}</Text>
175185
}
176186
```

0 commit comments

Comments
 (0)