File size: 468 Bytes
dbcdc7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Suspense, memo } from 'react';
import { Route, Routes } from 'react-router-dom';
import Fallback from './fallback';

const Routing = memo(({ pages }) => {
  return (
    <Suspense fallback={<Fallback />}>
      <Routes>
        {pages.map((page, index) => (
          <Route key={`${page.path}-${index}`} path={page.path} element={page.element} />
        ))}
      </Routes>
    </Suspense>
  );
});

Routing.displayName = 'Routing';
export default Routing;