Skip to content

Commit 1f6fcef

Browse files
authored
docs: Update window-focus-refetching.md (TanStack#1672)
1 parent f6aaa85 commit 1f6fcef

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

docs/src/pages/guides/window-focus-refetching.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,11 @@ Instead of event listeners on `window`, React Native provides focus information
6767
import { AppState } from 'react-native'
6868
import { focusManager } from 'react-query'
6969

70-
focusManager.setEventListener(setFocus => {
71-
const handleAppStateChange = appState => {
72-
setFocus(appState === 'active')
73-
}
74-
75-
AppState.addEventListener('change', handleAppStateChange)
70+
focusManager.setEventListener(handleFocus => {
71+
AppState.addEventListener('change', handleFocus)
7672

7773
return () => {
78-
AppState.removeEventListener('change', handleAppStateChange)
74+
AppState.removeEventListener('change', handleFocus)
7975
}
8076
})
8177
```

0 commit comments

Comments
 (0)