React. this.props.children не определен для компонента с вложенными подкомпонентами

Я новичок в React и не смог справиться с этой ошибкой. У меня есть два компонента, первый (маршрутизация):

var App = React.createClass({
  render: function() {
   return (
    <Template>
      <Locations>
        <Location path="/" handler={Catalog} />
        <Location path="/item/:item" handler={CatalogDetail} />
      </Locations>
    </Template>
   );
  }
});

и второй:

var Template = React.createClass({
  render: function() {
    return (
      <div className="container">
        {this.props.children} // should render one of child components
                              //{catalog}/{catalogDetail}
      </div>
    )
  }
});

this.props.children не определен, и я не мог понять, почему не видит ни один из этих компонентов {Catalog} или {CatalogDetail}

0 ответов

Другие вопросы по тегам