Presentational and Container Components

react团队成员之一的Dan Abramov在medium上写过一篇文章 Presentational and Container Components,他在文中将组件分为两类,分别是PresentationalContainerPresentational是展示类组件,比如说Page,Sidebar,Story,ListContainer组件是功能类组件,比如UserPage, FollowersSidebar, StoryContainer, FollowedUserList

它们是React组件的两种设计模式,和组件本身是class component还是function component关系不大。

前言

在前端开发发展的趋势中,已经越来越偏向于webapp模式,前端更像是app,但是现在的JavaScript语言中,没有原生的包的概念,这和JavaScript的历史有很大原因,由于Google开源的v8引擎以及NodeJS开源项目的成功,使得现在JavaScript的应用场景越来越多,但是原生不支持模块系统的问题一直存在,社区和Ecma提供了很多的解决方案,本文介绍其中一些比较知名的规范,如CommonJS、AMD等……