首页 > 其他 > 详细

React Native 第五天

时间:2018-04-06 21:58:31      阅读:197      评论:0      收藏:0      [点我收藏+]

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 第五天

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!