Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

cherniavskii/react-query-navigation-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-query-navigation-native

Integrates React Query with React Navigation for React Native apps.

Features

  • Automatically refetch queries on app focus (by subscribing to AppState)
  • Automatically refetch query on screen focus in useQuery hook (by using useFocusEffect from React Navigation)

Installation

$ npm i --save react-query-navigation-native
# or
$ yarn add react-query-navigation-native

Make sure, that you have react-query installed.

Usage

react-query-navigation-native re-exports everything from react-query. This means, that you can replace imports from react-query to react-query-navigation-native everywhere in your app and use it as earlier.

// import everything from react-query-navigation-native
- import { useQuery, useMutation, queryCache } from 'react-query'
+ import { useQuery, useMutation, queryCache } from 'react-query-navigation-native'

// or just import useQuery from react-query-navigation-native
- import { useQuery, useMutation, queryCache } from 'react-query'
+ import { useMutation, queryCache } from 'react-query'
+ import { useQuery } from 'react-query-navigation-native'

Docs

See react-query docs

About

React Query integration with React Navigation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published