1.3.4 • Published 3 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
3 years ago
1.3.4
3 years ago
1.3.3
3 years ago
1.3.2
3 years ago
1.2.3
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.0.1-alpha.1
3 years ago
1.0.1-alpha.3
3 years ago
1.1.0-alpha.1
3 years ago
0.3.9
3 years ago
0.3.13
3 years ago
0.3.12
3 years ago
0.3.11
3 years ago
0.3.10
3 years ago
0.5.0
3 years ago
0.4.1
3 years ago
0.4.0
3 years ago
0.4.2
3 years ago
0.3.8
3 years ago
0.3.7
3 years ago
0.3.6
3 years ago
0.3.3
3 years ago