容器

时间:2016-12-16 08:52:34

标签: javascript reactjs meteor react-jsx

我有一个容器,它将道具传递给一个组件,当我控制日志时一切正常但是当我尝试通过映射它失败的对象来显示它时

  

home4.js:41未捕获的TypeError:无法读取未定义的属性“map”(...)

我做错了什么?

// Child component
class ChildComponent extends Component {
  render() {
    console.log(this.props.scene);
    return (
    <div>

            {this.props.scene.map((item) => {
                    return (
                      <div> {item.set}</div>
                    )
                  })}

      <button onClick={this.props.incClick}> Inc </button>
      <button onClick={this.props.decClick}> Dec </button>

    </div>
  );
  }
}


//container
let Container = createContainer((props) => {
  let doc = Scenes.findOne({sheet_no: props.myCount})
  return {
    scene: doc
  }
}, ChildComponent);

0 个答案:

没有答案
相关问题