1.3.4 • Published 2 years ago
@booji/react v1.3.4
@booji/react
React端SDK,本包在
@booji/browser
的基础上添加了React的集成,用于拦截 React 的错误
使用示例
入口文件
import React from "react"
import ReactDOM from "react-dom";
import { init } from "@booji/react"
init({
dsn: "xxx",
appKey: "xxx"
})
ReactDOM.render(<App />, document.getElementById('root'));
ErrorBoundary
点击这里了解 React 的 ErrorBoundary
import { ErrorBoundary } from '@booji/react'
export default function FunctionalComponent() {
const onError = (error: Error, componentStack: string) => {
// 处理错误
}
const fallbackView = <p>出错啦,现在加载的是兜底视图</p>;
return (
<>
<ErrorBoundary onError={onError} fallback={fallbackView}>
<ComponentWithError />
</ErrorBoundary>
</>
)
}
1.2.0
2 years ago
1.3.4
2 years ago
1.3.3
2 years ago
1.3.2
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.0.1-alpha.1
2 years ago
1.0.1-alpha.3
2 years ago
1.1.0-alpha.1
2 years ago
0.3.9
2 years ago
0.3.13
2 years ago
0.3.12
2 years ago
0.3.11
2 years ago
0.3.10
2 years ago
0.5.0
2 years ago
0.4.1
2 years ago
0.4.0
2 years ago
0.4.2
2 years ago
0.3.8
2 years ago
0.3.7
2 years ago
0.3.6
2 years ago
0.3.3
2 years ago