The @axiomhq/react library is part of the Axiom JavaScript SDK, an open-source project and welcomes your contributions. For more information, see the GitHub repository.
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
- A new or existing React app.
Install @axiomhq/react library
-
In your terminal, go to the root folder of your React app and run the following command:
-
Create a
Logger
instance and export the utils. The example below uses theuseLogger
andWebVitals
components.
Send logs from components
To send logs from components, use theuseLogger
hook that returns your logger instance.
Send Web Vitals
To send Web Vitals, mount theWebVitals
component in the root of your React app.