The LogRocket SDK for Expo allows you to capture session replays, network requests and logs from Expo applications.
Quick Start
Register with LogRocket
Go to https://logrocket.com/signup to create a free trial account. If you already have a LogRocket account, you can use your existing account. All LogRocket accounts include 1,000 free mobile sessions.
Expo Web
For Expo web deployments, the LogRocket Javascript Web SDK must be used. See our web Quickstart and follow Web SDK guides from there. Note that the Web SDK can only be imported in Web builds of your app.
Mobile
Adding the SDK
Our React Native package is available on NPM. New releases of the LogRocket Native SDKs are catalogued on our Mobile SDK Changelog.
expo install @logrocket/react-native
And then edit your app.json
(or app.config.js
) to include our SDK in the plugins list:
{
"expo": {
// ... your existing configuration
"plugins": ["@logrocket/react-native"]
}
}
Initializing the SDK
Initializing the SDK is as simple as importing the package and running the initialization method. A good place to initialize the SDK is in a useEffect
hook in your top-level Application component.
Replace <APP_SLUG>
with your LogRocket application slug, located in our dashboard's quick start guides.
import React, { useEffect } from 'react';
import LogRocket from '@logrocket/react-native';
const App = () => {
useEffect(() => {
LogRocket.init('<APP_SLUG>');
}, []);
// Your application entry
};
Local Development Limitations
Expo Go, the local development client for the Expo Framework, does not support mobile Native code additions. Our React Native SDK uses Native code to power the entire system, and cannot run in the Expo Go client.
Our SDK will be fully operational when built with either npx expo run:
as described in the "Adding custom native code" guide or the EAS Build system, which can be accomplished locally provided the appropriate tooling is available.
Further Reading
For more information on using our SDK in React Native check out our documentation.