import RenderTest from "@/pages/render"; import { ReactElement } from "react"; import { Navigate, useRoutes } from "react-router-dom"; interface RouteItem { path: string; needLogin?: boolean; element: ReactElement; } const routes: RouteItem[] = [ { path: "/", needLogin: false, element: , }, { path: "*", element: , }, ]; const WrapperRoutes = () => { return useRoutes( routes.map((item: RouteItem) => { if (item.needLogin) { return { ...item, element: <>, }; } return item; }), ); }; export default WrapperRoutes;