redux路由配置

路由基本配置

npm i react-router-dom

import React from 'react'
import {HashRouter,Route,Switch,Link} from 'react-router-dom'
import Index from '../pages/component/Index.js'
import Register from '../pages/component/info/register.js'
import Setting from '../pages/component/info/setting.js'
import childerenSetting from '../pages/component/info/childerenSetting.js'
const BasicRoute=()=>(
    
    回到首页
     Register
     setting
        
            
            
            
            
                
                     
                    
                
            } >
        
    
)
export default BasicRoute

npm i react-router-config  react-loadable配置路由

import {renderRoutes} from 'react-router-config'

function App() {
  return (
    
    
      
附近的开始啦JFK了 {renderRoutes(routes)}
); }
import Loadable from './load.js'
const Index =Loadable( ()=>import('../pages/component/Index.js'))
const Register =Loadable( ()=>import('../pages/component/info/register.js'))
const Setting =Loadable( ()=>import( '../pages/component/info/setting.js'))
const childerenSetting =Loadable( ()=>import( '../pages/component/info/childerenSetting.js'))

const routes=[{
    path:'/',
    exact:true,
    component:Index,
},{
    path:'/index',
    component:Index,
},{
    path:'/register',
    component:Register,
},{
    path:'/setting',
    component:Setting,
}
]

export default routes

 

你可能感兴趣的:(javascript,reactjs)