Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Traceo SDK for React

Library for integration with Traceo Platform.

Installation

To install this SDK add this package to your project like below:

yarn add @traceo-sdk/react

or

npm install @traceo-sdk/react

Usage

To use this SDK initialize TraceoClient in your application.

import { TraceoClient } from "@traceo-sdk/react";

new TraceoClient(<project_api_key>, {
    host: <traceo_host>
});

// your code

ReactDOM.render(<App />, document.getElementById("root"));

And thats all what you need to handle errors and exceptions in your app.

Error Boundary

If you are using React in version >16 you can use ErrorBoundary component imported from @traceo-sdk/react to catch errors anywhere in the child components.

const traceoInstance = new TraceoClient(<project_api_key>, {
    host: <traceo_host>
});


<ErrorBoundary traceo={traceoInstance} fallback={(error) => <Fallback error={error} />}>
    // child components
</ErrorBoundary>

Performance

To enable collect of web-vitals data, you have to set performance param to true like below:

new TraceoClient(<project_api_key>, {
    host: <traceo_host>,
    performance: true
});

Support

Feel free to create Issues, Pull Request and Discussion.