import { observer } from 'mobx-react' ; import { Route , Routes } from 'react-router-dom' ; import { UserStore } from 'stores' ; import routes from './routes' ; function Index ( ) { return ( < > < Routes > { routes . map ( ( item , indexKey ) => { if ( item ?. login && ! UserStore ?. me ) { return null ; } if ( item ?. childs ) { return ( < Route key = { indexKey } path = { item . path } element = { item . component } > { item ?. childs . map ( ( childItem , childIndexKey ) => { return ( < Route key = { 'childs_' + childIndexKey } path = { item . path + childItem . path } index = { childItem ?. index } element = { childItem . component } / > ) ; } ) } < /Route>); } return < Route key = { indexKey } path = { item . path } element = { item . component } / > ; } ) } < /Routes> < />); } export default observer ( Index ) ;