index.js 881 B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import ReactDOM from 'react-dom/client';
  3. import './index.css';
  4. import reportWebVitals from './reportWebVitals';
  5. // import App from './App';
  6. import router from './router';
  7. import { RouterProvider } from 'react-router-dom';
  8. // const routes = [
  9. // {
  10. // path: '/',
  11. // element: <App />,
  12. // }, // 路由对象 RouteObject
  13. // {
  14. // path: '/about',
  15. // element: <div>关于</div>,
  16. // },
  17. // ];
  18. // const router = createBrowserRouter(routes);
  19. const root = ReactDOM.createRoot(document.getElementById('root'));
  20. root.render(
  21. <React.StrictMode>
  22. <RouterProvider router={router} />
  23. </React.StrictMode>
  24. );
  25. // If you want to start measuring performance in your app, pass a function
  26. // to log results (for example: reportWebVitals(console.log))
  27. // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
  28. reportWebVitals();