NuGet npm Samples

Logging to from React

To log all errors from a React application, install the npm package as described in Logging from JavaScript. Then modify the index.js or index.tsx file:

// ...
import Elmahio from ''; 

new Elmahio({
  apiKey: 'API_KEY',
  logId: 'LOG_ID'

// After this the ReactDOM.render etc. will be included

When launching your React app, is configured and all errors happening in the application are logged.

Check out the elmahio-react and elmahio-react-typescript samples for some real working code.

React have a known bug/feature in DEV mode where errors are submitted twice. For better error handling in React, you should look into Error Boundaries.

This article was brought to you by the team. is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website