如果创建好react脚手架可以直接跳过
注:图片下面有代码
npm install react-router-dom@5.2.0 react-router-config -S
在scr的index.js中引入下面的
import {HashRouter as Router} from 'react-router-dom'
在scr的index.js中引入下面的
替换成
然后新建view文件夹并且创建两个文件Index.js和List.js 在上面写上以下内容
import { Component } from "react";
class List extends Component{
render(){
return (<div>this is List</div>)
}
}
export default List;
这个文件也一样写