import React, { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { Navigate, useRoutes } from 'react-router'; import DashboardLayout from '../components/DashboardLayout'; import { Dispatch } from '../models/store'; import NotFound from './NotFound'; import HomePage from './Home' const AppRouters: React.FC = () => { const dispatch = useDispatch(); useEffect(() => { (window as any).__dispatch__ = dispatch; return () => { delete (window as any).__dispatch__; } }, [dispatch]); let element = useRoutes([ { path: '/', element: }, { path: '/mgr', element: , children: [ { path: 'home', element: }, { path: 'real', element: }, { path: '*', element: }, ] }, { path: '*', element: }, ]); return element; } export default AppRouters