|
| 1 | +# React Query Native Devtool |
| 2 | + |
| 3 | +React Native Query Devtool is a monorepo containing a React Native component and a standalone app to visualize query data in a similar way to react-query-devtools for the web. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Provides a component for integrating query data in React Native applications running react-query v3, and @tanstack/react-query v4 and v5. |
| 10 | +- Includes a standalone app to visualize and help debug query data. |
| 11 | + |
| 12 | +## Standalone App |
| 13 | + |
| 14 | +The standalone app allows you to visualize and debug query data from your React Native application using the `@jdl/react-native-query-devtool` package. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +You can download the standalone app from the following link. Currently, it's available only for **macOS M1**: |
| 19 | + |
| 20 | +[Download latest App](https://github.com/jossydeleon/react-native-query-devtool-monorepo/releases) |
| 21 | + |
| 22 | +**Windows and Linux users:** You need to build the app from source as it's currently only available for **macOS M1**. Ensure to set up your environment accordingly before building the app. |
| 23 | + |
| 24 | +```bash |
| 25 | +# Go to app folder |
| 26 | +cd react-native-query-devtool-app |
| 27 | + |
| 28 | +# Install dependencies |
| 29 | +yarn |
| 30 | + |
| 31 | +# Build |
| 32 | +yarn build-server |
| 33 | +``` |
| 34 | + |
| 35 | +After running the build command, you'll find the freshly built app in a new folder named **'out'**. |
| 36 | + |
| 37 | +## React Native Component |
| 38 | + |
| 39 | +To use the devtool component in your React Native project, install the package: |
| 40 | + |
| 41 | +```bash |
| 42 | +npm install @jdl/react-native-query-devtool |
| 43 | +# or |
| 44 | +yarn add @jdl/react-native-query-devtool |
| 45 | +``` |
| 46 | + |
| 47 | +## Usage |
| 48 | + |
| 49 | +In your React Native application, import `QueryNativeDevtool` to send query data to the server app for debugging: |
| 50 | + |
| 51 | +```javascript |
| 52 | +import { QueryNativeDevtool } from "@jdl/react-native-query-devtool"; |
| 53 | + |
| 54 | +export default function App() { |
| 55 | + return ( |
| 56 | + <QueryClientProvider client={queryClient}> |
| 57 | + <View style={styles.container}> |
| 58 | + <Main /> |
| 59 | + </View> |
| 60 | + <QueryNativeDevtool queryClient={queryClient} /> |
| 61 | + </QueryClientProvider> |
| 62 | + ); |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +## Support for react-query v3 |
| 67 | + |
| 68 | +If your app runs `react-query v3` pass `version="v3"` prop to `QueryNativeDevtool` |
| 69 | + |
| 70 | +```javascript |
| 71 | +import { QueryNativeDevtool } from "@jdl/react-native-query-devtool"; |
| 72 | + |
| 73 | +export default function App() { |
| 74 | + return ( |
| 75 | + <QueryClientProvider client={queryClient}> |
| 76 | + <View style={styles.container}> |
| 77 | + <Main /> |
| 78 | + </View> |
| 79 | + <QueryNativeDevtool queryClient={queryClient} version="v3" /> |
| 80 | + </QueryClientProvider> |
| 81 | + ); |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +This will enable your React Native application to send query data to the Electron app for debugging purposes. |
| 86 | + |
| 87 | +## Examples |
| 88 | + |
| 89 | +In the example folder, you can find example projects demonstrating the usage of `@jdl/react-native-query-devtool` with different versions of React Query (v3, v4, and v5). To test the examples, navigate to the example folder, select the desired example, and run yarn ios or yarn android. |
| 90 | + |
| 91 | +```bash |
| 92 | +cd example |
| 93 | + |
| 94 | +# Navigate to the desired example, for example: |
| 95 | +cd react-query-v3 |
| 96 | + |
| 97 | +# Install dependencies |
| 98 | +yarn |
| 99 | + |
| 100 | +# Run example |
| 101 | +yarn ios |
| 102 | +# or |
| 103 | +yarn android |
| 104 | +``` |
0 commit comments