React 0.13.3 Uncaught TypeError:无法读取null的属性'ref'

时间:2015-06-08 12:42:52

标签: reactjs router react-router-component

我使用react-router-component。

获取此错误: 未捕获的TypeError:无法读取null的属性'ref'

var Locations = Router.Locations;
var Location = Router.Location;

var NotFound = Router.NotFound;

var APP =
  React.createClass({
    render:function(){
      return (
        <Template>
          <Locations>
            <location path="/" handler={Frontpage} />
            <location path="/new-estate" handler={NewEstate} />
          </Locations>
        </Template>
        )
    }
  });

此行在控制台中标记为导致错误的行(由星号标记):

var RouteRenderingMixin = {

  renderRouteHandler: function(props) {
    var handler = this.state.handler;
    **props = assign({ref: this.state.match.route.ref}, props);**
    // If we were passed an element, we need to clone it before passing it along.
    if (React.isValidElement(handler)) {
      return cloneWithProps(handler, props);
    }
    return React.createElement(handler, props);
  }

};

如何解决?

0 个答案:

没有答案