testing error page
This commit is contained in:
parent
436c14fcc4
commit
d66b618f22
14
src/index.js
14
src/index.js
|
|
@ -7,15 +7,25 @@ import { BrowserRouter, Route, Routes, useLocation } from "react-router-dom";
|
||||||
import { AnimatePresence } from "framer-motion";
|
import { AnimatePresence } from "framer-motion";
|
||||||
import Home from "./pages/Home.jsx";
|
import Home from "./pages/Home.jsx";
|
||||||
import Profile from "./pages/Profile.jsx";
|
import Profile from "./pages/Profile.jsx";
|
||||||
import {ErrorBoundary} from "./components/ErrorBoundary.jsx";
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
// import { ErrorBoundary } from "./components/ErrorBoundary.jsx";
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||||
|
|
||||||
|
function fallbackRender({ error, resetErrorBoundary }) {
|
||||||
|
return (
|
||||||
|
<div role='alert'>
|
||||||
|
<p>Something went wrong:</p>
|
||||||
|
<pre style={{ color: "red" }}>{error.message}</pre>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<UserContextProvider>
|
<UserContextProvider>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<ErrorBoundary fallback={<p>Something went wrong</p>}>
|
<ErrorBoundary fallbackRender={fallbackRender}>
|
||||||
<App />
|
<App />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user