0.2.2 • Published 5 years ago

react-query-navigation-native v0.2.2

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

react-query-navigation-native

npm.io

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