- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我实际上正在使用 Fluxible 开发一个应用程序,但我在使用路由参数时遇到了问题。
实际上,我有这个渲染函数:
render() {
return (
<div className="card small hoverable">
<div className="card-image">
<img src="http://www.gizmobolt.com/wp-content/uploads/2014/11/14-77.jpg"/>
<span className="card-title">{this.props.title}</span>
</div>
<div className="card-content">
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div className="card-action">
<NavLink routeName="ProjectDetail" navParams={{id: this.props.key}}>Manage</NavLink>
</div>
</div>
);
}
我的 ./conf/routes.js 中的这条路线:
项目详细信息:{ 路径: '/project/:id/details', 方法:'获取', 页面:“项目详细信息”, title: '项目细节', 处理程序: require('../components/ProjectDetail'), 不在菜单中:true }
这是我得到的错误:
/soft/blog/node_modules/fluxible-router/lib/createNavLinkComponent.js:94
throw new Error('NavLink created without href or unresolvable
^
Error: NavLink created without href or unresolvable routeName 'ProjectDetail'
只有当我尝试在routes.js中使用参数化路由时才会发生这种情况。
我不知道如何做不同的事情:-/
最佳答案
根据https://github.com/facebook/react/issues/2429您无法从组件引用 this.key
或 this.props.key
。
推荐in this comment是为了
I would suggest renaming or duplicating the prop [sic key] name as a possible fix if you really need to access it.
所以将你的代码更改为类似的内容
render() {
return (
<div className="card small hoverable">
<div className="card-image">
<img src="http://www.gizmobolt.com/wp-content/uploads/2014/11/14-77.jpg"/>
<span className="card-title">{this.props.title}</span>
</div>
<div className="card-content">
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div className="card-action">
<NavLink routeName="ProjectDetail" navParams={{id: this.props.id}}>Manage</NavLink>
</div>
</div>
);
}
并在父渲染组件中执行以下操作:
render() {
{this.states.cards.map(function eachCard(card) {
return <CardItem key={card.id} id={card.id} />;
});
}
关于javascript - Fluxible 和 Navlink 路由错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32586124/
我有一个非常简单的 Fluxible 商店: export default class NoteStore extends BaseStore { static storeName = "Note
我实际上正在使用 Fluxible 开发一个应用程序,但我在使用路由参数时遇到了问题。 实际上,我有这个渲染函数: render() { return (
我的应用程序是 Fluxible/React 应用程序。 我有以下规范尝试测试登录表单。嵌入式组件已使用重新接线进行 stub 。我引用了http://fluxible.io/api/componen
嗨,我实际上正在尝试使用 Flux、ReactJS 和 Fluxible 开发一些小应用程序,但在处理商店时遇到了问题。 事实上,我可以通过操作向我的商店发送信息,但我不知道如何在组件内部的商店中接收
我正在开发一个与 Fluxible 配合使用的最小应用程序。几乎所有事情看起来都很清楚,但只有一件事:脱水和再水合状态的概念。 我知道这是在客户端和服务器之间同步存储所需要的,但我不知道为什么。这条线
我正在使用 React & Fluxible & electron 处理应用程序流程,它遵循标准的 react 流程,即 component -> action -> store -> compone
我是一名优秀的程序员,十分优秀!