0.0.2 • Published 2 years ago

react-utils-module v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

配置文件(router.ts)

import React from 'react';
import { useRoutes } from 'react-router-dom';
import { lazyRouter } from 'react-utils-module';

const routes = lazyRouter([
  {
    path: '',
    element: () => import('@/pages/login'),
  },
  {
    path: '/home',
    element: () => import('@/pages/home'),
    children: [
      {
        path: '/home/about',
        element: () => import('@/pages/about'),
      },
    ],
  },
]);

export default () => {
  const _routes = useRoutes(routes);
  return <>{_routes}</>;
};