码迷,mamicode.com
首页 > 其他好文 > 详细

React Native 第五天

时间:2018-04-06 22:32:41      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:ola   lis   map   size   turn   add   ble   idt   container   

React Redux

  • 容器组件:一个容器查找数据并且渲染它相对应的子组件。相对应 意为 拥有相同名字的组件。比如:

StockWidgetContainer => StockWidget

TagCloudContainer => TagCloud

PartyPooperListContainer => PartyPooperList

2.我们有一个组件

class CommentList extends React.Component {

this.state = { comments: [] };

 

componentDidMount() {

fetchSomeComments(comments =>

this.setState({ comments: comments }));

}

render() {

return (

<ul>

{this.state.comments.map(c => (

<li>{c.body}{c.author}</li>

))}

</ul>

);

}

}

React Native 第五天

标签:ola   lis   map   size   turn   add   ble   idt   container   

原文地址:https://www.cnblogs.com/NerverLate/p/8728830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!