使用flow-router时的React.createelement警告

时间:2015-12-11 23:31:06

标签: javascript meteor reactjs react-jsx

当我将此代码添加到我的Meteor应用程序时:

Home =  FlowRouter.route("/", {
  name: "App",
  action(params) {
    ReactLayout.render(App);
  }
});

它在chrome控制台中显示此错误:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

我做错了什么?

1 个答案:

答案 0 :(得分:0)

好的,我设法通过将action(params)替换为action function ()来绕过此错误,所以我现在的代码如下所示:

Home =  FlowRouter.route("/", {
  name: "App",
  action function() {
    ReactLayout.render(App);
  }
});

我不知道它是否是正确的解决方案,或者是什么导致了这个问题,它似乎对我有用,所以也许它可以为有这个问题的人工作同样的问题。

相关问题