首页 > 其他 > 详细

react中遇到的事

时间:2018-05-19 16:39:03      阅读:188      评论:0      收藏:0      [点我收藏+]

1.路由跳转问题:

        。 可以使用标签跳转,如Link .NavLink等。

        。 如果组件是在Route中的组件,那么该组件的this.props.history.push()可以设置路由,如果组件不在Route中,那么this.props中没有history对象。

        。使用 history模块

import { createHashHistory } from history
const history = createHashHistory()
ReactDOM.render(<Router history={history} routes={routes}></Router>, ...)

2.组件上不能加clssName,加clssName无效。

react中遇到的事

原文:https://www.cnblogs.com/BlingSun/p/9060444.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!