【发布时间】:2015-12-15 13:37:59
【问题描述】:
我正在尝试使用流路由器在流星中做出反应。路由定义如下:
FlowRouter.route('/',
{
action(){
const containerElement = document.getElementById("react-root");
if (containerElement) {
const app = React.createElement("<App/>");
ReactDOM.render(app, containerElement);
} else {
console.log("no element react-root found");
}
}
})
HTML 非常基础:
<head>
<title>Todo List</title>
</head>
<body>
<div id="react-root">react-root</div>
</body>
当我启动流星并导航到 localhost:3000 时,我在页面上收到 react-root,在控制台中收到消息 no element react-root found。
我试图将路由定义包装在 Meteor.startup( 中,但随后我收到一个错误,即路由 / 未定义。
【问题讨论】:
标签: meteor