如何在react-router v1.0.0中填充这个.props.params
How to get this.props.params populated in react-router v1.0.0?
当我尝试访问this.props.params
时,它未定义。this.context.router
为{}
我尝试了向组件添加contextTypes的不同变体:
contextTypes: {
router: React.PropTypes.func.isRequired
}
但运气不好。
我的主要目标是将当前的react-router url传递给服务器。
如下所示:https://github.com/rackt/react-router/blob/v0.11.6/examples/query-params/app.js,您需要添加Router.State
mixin:
var User = React.createClass({
mixins: [ Router.State ],
相关文章:
- 如何从reactjs中的按钮向函数传递props
- Node.js req.params.locationid not grabbing ID
- React.cloneElement:传递新的孩子或复制props.children
- 与params的onclick调用
- React Router,在params之后嵌套路由
- 正在获取props值的子字符串-React
- Angularjs - url params:单击时返回 url 中的角度变量
- 从ReactJS中的amplificPopup访问@props
- 从params推送到对象(如果不存在)
- nextProps 总是与 this.props 相同,即使 props 在 componentWillReceiveP
- This.props.dispatch not a function - React-Redux
- 当我将 GET /any 发送到自定义路由“GET /:id”时,我得到 req.params.id = 'favico
- 在 React 中嵌套组件,props 不会传递给子组件
- Angularjs:将对象params传递给state
- 使用Angular/Rails发送带有params的http请求
- 带有查询字符串params的angular ui路由器空白页
- React props={this.refs.something} undefined
- 如何在react-router v1.0.0中填充这个.props.params
- 基于this.props.params.id的React过滤器数组
- React Router: this.props.params在链接点击后没有更新