react项目中使用react-router-dom

  • Post author:
  • Post category:其他




1. 安装react-router-dom

npm install react-router-dom -S



2. 新建router.js

import React from 'react'
import {
  HashRouter, Route, Switch, hashHistory, Redirect
} from 'react-router-dom'
import App from './App'
import Login from './views/Login/Login'
import List from './List/List'

const BasicRoute = () => (
  
    <Route exact path="/login" component={Login} />
    <Route exact path="/list" component={List} />
  
);

export default BasicRoute



版权声明:本文为weixin_43588821原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。