@@ -12,34 +12,29 @@ yarn add -D reactotron-apollo-client
12
12
13
13
## Usage
14
14
15
- Import your mmkv storage instance :
15
+ Create your Apollo Client as you normally would, and then add the ` reactotron-apollo-client ` plugin: :
16
16
17
17
``` js
18
- import { MMKV } from " @apollo/client"
19
- export const storage = new MMKV ()
18
+ import { ApolloClient , InMemoryCache } from " @apollo/client"
19
+
20
+ const cache = new InMemoryCache ()
21
+ export const client = new ApolloClient ({
22
+ uri: " https://api.graphql.guide/graphql" ,
23
+ cache,
24
+ defaultOptions: { watchQuery: { fetchPolicy: " cache-and-network" } },
25
+ })
20
26
```
21
27
22
- To use the ` mmkvPlugin ` , add the additional plugin on the ` import ` line.
28
+ To use the ` apolloPlugin ` , add the additional plugin on the ` import ` line.
23
29
24
30
``` js
25
31
import Reactotron from " reactotron-react-native"
26
- import mmkvPlugin from " reactotron-apollo-client"
27
- import { storage } from " ./mmkv/storage/instance /location" // <--- update this location
32
+ import apolloPlugin from " reactotron-apollo-client"
33
+ import { client } from " ./apolloClient /location" // <--- update this location
28
34
...
29
35
Reactotron .configure ()
30
- .use (mmkvPlugin ({ storage })) // <--- here we go!
36
+ .use (apolloPlugin ({ apolloClient : client })) // <--- here we go!
31
37
.connect ()
32
38
```
33
39
34
- And you're done! Now you can see your MMKV in Reactotron.
35
-
36
- ## Advanced Usage
37
-
38
- ` mmkvPlugin() ` accepts an object with an ` ignore ` key. The value is an array of strings you would like to prevent sending to Reactotron.
39
-
40
- ``` js
41
- mmkvPlugin ({
42
- storage,
43
- ignore: [" secret" ],
44
- })
45
- ```
40
+ And you're done! Now you can see your Apollo caches, queries, and mutations in Reactotron.
0 commit comments