Socket
Socket
Sign inDemoInstall

@sentry/react

Package Overview
Dependencies
Maintainers
11
Versions
369
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/react

Official Sentry SDK for React.js


Version published
Weekly downloads
2.1M
decreased by-39.97%
Maintainers
11
Weekly downloads
 
Created

What is @sentry/react?

The @sentry/react package is designed for error monitoring and performance tracking in React applications. It provides a comprehensive set of tools to capture exceptions, track performance issues, and improve the overall reliability of React applications. By integrating Sentry into a React project, developers can gain insights into errors and performance bottlenecks, allowing for quicker debugging and optimization.

What are @sentry/react's main functionalities?

Error Boundary

This feature automatically catches JavaScript errors anywhere in the child component tree of the Error Boundary and logs them to Sentry. It also displays a fallback UI instead of the component tree that crashed.

import React from 'react';
import * as Sentry from '@sentry/react';

const MyApp = () => (
  <Sentry.ErrorBoundary fallback={'An error has occurred'}>
    <YourApp />
  </Sentry.ErrorBoundary>
);

Performance Monitoring

Enables performance monitoring in your React application. By setting the `tracesSampleRate` to a value between 0 and 1, you can control the percentage of transactions sent to Sentry for performance analysis.

import * as Sentry from '@sentry/react';

Sentry.init({
  dsn: 'YOUR_DSN',
  tracesSampleRate: 1.0,
});

Custom Error Tracking

Allows for manual reporting of errors or exceptions to Sentry, giving developers the flexibility to capture specific issues that may not be automatically detected.

import * as Sentry from '@sentry/react';

Sentry.captureException(new Error('This is my custom error.'));

Other packages similar to @sentry/react

FAQs

Package last updated on 03 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc