componentDidCatch with React and global error handling

I wrap the App with a component that handle errors with componentDidCatch it re-render the app and create an infinite loop of error because “app is already initialized”.
I moved the component inside the App to wrap only the main view and it works.
Is there a “correct” way to handle errors?
I need to send them to GA for tracking.