npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-query

v1.0.1

Published

A React Native wrapper for TanStack Query (React Query) that adds intelligent network-aware refetching using NetInfo.

Downloads

94

Readme

React Native Query

A React Native wrapper for TanStack Query (React Query) that adds intelligent network-aware refetching using NetInfo.

What is this?

react-native-query is a 1:1 wrapper around TanStack Query that enhances it with native network state detection. It automatically handles query refetching when your app:

  • Regains internet connectivity
  • Comes back from the background
  • Reconnects to a network

This package uses @react-native-community/netinfo under the hood to provide a more reliable and native refetch experience compared to the web-based network detection in vanilla TanStack Query.

Installation

npm install react-native-query
# or
yarn add react-native-query
# or
pnpm add react-native-query

Additional Setup

Since this package uses NetInfo, you need to install its peer dependency:

npm install @react-native-community/netinfo
# or
yarn add @react-native-community/netinfo

For iOS, don't forget to install pods:

cd ios && pod install

Migration from TanStack Query

If you're already using TanStack Query, migration is simple:

  1. Remove TanStack Query (it will be installed automatically as a dependency):
   npm uninstall @tanstack/react-query
  1. Replace imports throughout your codebase:
// Before
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';

// After
import { useQuery, QueryClient, QueryClientProvider } from 'react-native-query';

That's it! Everything else works exactly the same.

Usage

Use it exactly like TanStack Query:

import { QueryClient, QueryClientProvider, useQuery } from 'react-native-query';

// Create a client
const queryClient = new QueryClient();

// Wrap your app
function App() {
  return (



  );
}

// Use queries as normal
function MyComponent() {
  const { data, isLoading } = useQuery({
    queryKey: ['todos'],
    queryFn: fetchTodos,
  });

  // ... rest of your component
}

What's Different?

The only difference is the QueryClientProvider component, which has been enhanced to:

  • Listen to network state changes via NetInfo
  • Automatically refetch queries when connectivity is restored
  • Provide better offline/online detection for React Native environments

All other APIs, hooks, and functionality remain 100% identical to TanStack Query.

Documentation

For complete API documentation, configuration options, and advanced usage, refer to the official TanStack Query documentation.

Everything documented there applies to this package.

Why Use This?

  • Better network detection - Uses native NetInfo instead of browser APIs
  • Drop-in replacement - No code changes needed beyond imports
  • Automatic refetching - Handles connectivity changes intelligently
  • Always up-to-date - Stays in sync with TanStack Query releases
  • React Native optimized - Built specifically for mobile environments

License

MIT