react-query-navigation-native

0.2.2 • Public • Published

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

Package Sidebar

Install

npm i react-query-navigation-native

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

3.54 kB

Total Files

4

Last publish

Collaborators

  • cherniavskii