Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/morkeleb/js-analytics-react
https://github.com/morkeleb/js-analytics-react
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/morkeleb/js-analytics-react
- Owner: morkeleb
- Created: 2021-11-02T07:02:21.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-01T19:54:02.000Z (almost 3 years ago)
- Last Synced: 2024-11-09T19:20:05.620Z (about 2 months ago)
- Language: TypeScript
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# @js-analytics/react
@js-analytics/react is a TypeScript library for collecting and reporting errors to https://js-analytics.com.
## Installation
Use the package manager npm or yarn to install @js-analytics/react.
```bash
npm install -S @js-analytics/react
```or
```bash
yarn add @js-analytics/react
```## Usage
The monitor works with react error boundaries. By wrapping your react app with the code you want the monitor to keept rack of you can have all errors reported back to js-analytics. Allowing you to fix them according to how often they occur.
```typescript
import { JSAMonitor } from '@js-analytics/react';
// more code here
// in your render
return (
your react code goes here
)```
in Next.js I recommend placing is in the `pages/_app.tsx` file:
```typescriptimport { JSAMonitor } from '@js-analytics/react';
function MyApp({ Component, pageProps, router }) {
return (
your react code goes here
);
}export default MyApp;
```
This will capture all errors that occur during server-side render and client-side executions and report them to JS-Analytics.## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)