如何隐藏ID显示在网址中?
<Route path="/AddShop/:id" component = {AddShop} />
答案 0 :(得分:0)
您可以在链接中使用状态
路线
<Route exact={true} path="/post_view" component={PostView} />
链接
<Link
to={{
pathname: `/post_view`,
state: {
id: item.id
}
}}
className="btn btn-sm btn-primary pull-right">
view
</Link>
查看页面
const post_id = props.location.state.id;
唯一的限制是当您共享链接时,状态将没有该ID