一、路由跳转
1、a标签跳转
import { Link } from "react-router-dom";
<Link to="/map">go map</Link>
2、js跳转
this.props.history.push("/map");
一、路由传参
1、state(不消失)
// 传
this.props.history.push({ pathname: '/fag',state:{id:6666}});
// 取
console.log(this.props.location.state.id)
2、params(不消失)
{
path: "/fag/:id",
component: Faq,
}
this.props.history.push({ pathname: `/fag/${6666}`});
console.log(this.props.match.params.id)
3、query(会消失)
this.props.history.push({ pathname: '/fag',query:{id:6666}});
console.log(this.props.location.query.id)