반응형
https://www.npmjs.com/package/react-error-boundary
react-error-boundary
Simple reusable React error boundary component. Latest version: 5.0.0, last published: 2 months ago. Start using react-error-boundary in your project by running `npm i react-error-boundary`. There are 1487 other projects in the npm registry using react-err
www.npmjs.com
공식문서에 있는 에러페이지를 만들어도 되는데... 귀찮으니까...
import { ErrorBoundary } from "react-error-boundary";
function fallbackRender({ error, resetErrorBoundary }) {
// Call resetErrorBoundary() to reset the error boundary and retry the render.
const {reset} = useQueryErrorResetBoundary();
return (
<div role="alert">
<p>Something went wrong:</p>
<pre style={{ color: "red" }}>{error.message}</pre>
</div>
);
}
<ErrorBoundary
fallbackRender={fallbackRender} // 보여질 화면
onReset={reset} // 다른 이벤트가 발생할떄 호출하는 속성 예를들어 tanstack 통신에러 등..
>
<ExampleApplication />
</ErrorBoundary>;
728x90
'코딩 > React Native' 카테고리의 다른 글
[RN]애플 로그인(react-native-apple-authentication) (0) | 2025.02.22 |
---|---|
[RN] Splash 화면 설정하기 (0) | 2025.02.21 |
[RN] react native webview 빈화면 버그 (0) | 2025.02.20 |
[RN] react-native-config .env not update (0) | 2025.02.19 |
[RN] 네비게이션 라우팅 drawer에서 stack 네비게이터로 이동하는 방법. (0) | 2025.02.06 |