links: React Native MOC


Setup

In order to understand the root cause of crashes for production users tools like Sentry can be your friend. in order to integrate follow these steps

  1. Add yarn add @sentry/react-native Sentry’s React Native Package to your app
  2. Sentry provides a wizard package which can be used to automatically setup the project. Use this command to do setup automatically
npx @sentry/wizard -i reactNative -p ios android
  1. If you have iOS project do npx pod install
  2. Now in your App.js file initialize the Sentry SDK
import * as Sentry from "@sentry/react-native";
 
Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
});
  1. Finally wrap your app with Sentry
const SentryApp = Sentry.wrap(App)
export default codePush(codePushOptions)(SentryApp);

if you are using code push, ensure it’s the outermost function because it needs access to the root component in order to swap out the bundle.


tags: react-native error sources: