刚开始学react,遇到一个问题,求指点设置当前显示路由的class报错import React,{ Component } from "react";import router1 from './router1';import router2 from './router2';import router3 from './router3';import "./main.css";import { BrowserRouter as Router, Route, Link}from 'react-router-dom';class main extends Component {render() { return ( <Router> <div> <ul> <li><Link to="/" className="active" activeClassname="current">路由1</Link></li> <li><Link to="/router2" className="active" activeClassname="current">路由2</Link></li> <li><Link to="/router3" className="active" activeClassname="current">路由3</Link></li> </ul> <hr /> <Route exact path="/" component={router1} /> <Route path="/router2" component={router2} /> <Route path="/router3" component={router3} /> </div> </Router> );}}export default main;提示说换成小写的,但是换成小写的不报错了,却不起作用?刚学了一天react,求大佬指点
添加回答
举报
0/150
提交
取消