Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can I use the useReactNative method to monitor Axios requests without Apisauce


Can I use the useReactNative method to monitor Axios requests without Apisauce


Yes, you can use the `.useReactNative()` method to monitor Axios requests in Reactotron without using Apisauce. Here's how:

1. Configure Reactotron to use the `networking` plugin, which will monitor network requests:

js
import Reactotron, { networking } from 'reactotron-react-native'

Reactotron
  .configure()
  .useReactNative(networking())
  .connect()

2. Make your Axios requests as usual, and they will be logged in Reactotron's network tab:

js
import axios from 'axios'

axios.get('https://api.example.com/data')
  .then(response => console.log(response.data))
  .catch(error => console.error(error))

The `.useReactNative()` method with the `networking` plugin will automatically monitor all network requests made by your React Native app, including those made with Axios[1][2].

You no longer need to use `reactotron-apisauce` or call `.addMonitor()` on the Reactotron instance. The built-in `networking` plugin will handle monitoring the requests.

This approach works with newer versions of React Native (44+) and Reactotron-React-Native. The networking plugin is documented in the Reactotron repo[2].

Citations:
[1] https://stackoverflow.com/questions/49269595/how-to-set-up-reactotron-apisauce-in-react-native
[2] https://github.com/infinitered/reactotron/issues/590
[3] https://stackoverflow.com/questions/tagged/apisauce?tab=Active
[4] https://github.com/axios/axios/issues/535
[5] https://blog.logrocket.com/using-axios-with-react-native-manage-api-requests/