![](/img/trans.png)
[英]Getting undefined is not an object in React native when rendering
[英]React Native: “undefined is not an object” Rendering components with ListView and external dataSource
我有一个应该呈现ListView的Container组件。
ListView的dataSource需要调用带有“保留”列表的外部(但本地)JSON文件。
ListView应该为带有标题的JSON文件中的每个条目呈现一个新的“卡片”。
但是,出现以下错误:
未定义不是对象(评估“ this.props.dataSource.title”)
以下是我的代码要点...我在做什么错?
https://gist.github.com/chapeljuice/316cb72432bf0d3ff90ca93349b85570
我想如果你用
this.props.data.title
要么
this.props.title
代替
this.props.dataSource.title
你可以得到答案。 因为当您将数据传递到“ ReservationCard”时,数据将作为其道具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.