From 5f4ddc8fd7d84500457bb08b0981a84a2d1594b1 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Sat, 18 Jun 2022 23:59:14 +0400 Subject: Bump React To 18.2.0 Bump react to v18, and handle all the breaking changes. This includes bumping a lot of other dependencies to versions which support react 18, and handling the breaking changes for those. Refer to the following documents for migration guides: React: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html Router: https://reactrouter.com/docs/en/v6/upgrading/v5 Signed-off-by: Hassan Abouelela --- src/App.tsx | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'src/App.tsx') diff --git a/src/App.tsx b/src/App.tsx index 523e583..752a6c6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,11 +3,7 @@ import React, { Suspense } from "react"; import { jsx, css, Global } from "@emotion/react"; -import { - BrowserRouter as Router, - Route, - Switch -} from "react-router-dom"; +import { BrowserRouter, Route, Routes } from "react-router-dom"; import { PropagateLoader } from "react-spinners"; @@ -35,31 +31,33 @@ function PageLoading() { ; } +function Routing(): JSX.Element { + const renderedRoutes = routes.map(({path, Component}) => ( + }> + }/> + )); + + return ( + + {renderedRoutes} + + ); +} + function App(): JSX.Element { return (
- - ( - - - - {routes.map(({path, Component}) => ( - - }> - - - - ))} - - - - )}/> - + + + + + }/> + + + +
); } -- cgit v1.2.3