we leverage private components to break our render function into more manageable pieces without leaking the implementation details of our component.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="//fb.me/react-0.14.3.js"></script>
<script src="//fb.me/react-dom-0.14.3.js"></script>
</head>
<body>
<div id="app"></div>
</body>
</html>
const users = [
{ name: 'Merrick', id: 1 },
{ name: 'John', id: 2 },
{ name: 'Trevor', id: 3 }
] const UserListItem = ({user}) => {
return (
<div>
{user.name}
</div>
);
}; class UserList extends React.Component {
render(){
return (
<div>
<h1>Users</h1>
{
this.props.users.map( (user) => {
return <UserListItem user={user} key={user.id} />
})
}
</div>
);
}
} ReactDOM.render(<UserList users={users} />, document.getElementById('app'));

[React] Extracting Private React Components的更多相关文章

  1. [React] Render Text Only Components in React 16

    In this session we create a comment component to explore how to create components that only render t ...

  2. [React] Recompose: Theme React Components Live with Context

    SASS Bootstrap allows us to configure theme or branding variables that affect all components (e.g. P ...

  3. react聊天室|react+redux仿微信聊天IM实例|react仿微信界面

    一.项目概况 基于react+react-dom+react-router-dom+redux+react-redux+webpack2.0+react-photoswipe+swiper等技术混合开 ...

  4. [react] 细数 React 的原罪

    Props & onChange 的原罪 .「props & onChange 接口规范」它不是一个典型的「程序接口规范」. 当你拿到一个可视组件的 ref,却没有类似 setProp ...

  5. React笔记:React基础(2)

    1. JSX JSX是一种拥有描述UI的JavaScript扩展语法,React使用这种语法描述组件的UI. 1.1 基本语法 JSX可以嵌套多个HTML标签,可以使用大部分符号HTML规范的属性. ...

  6. react初探索--react + react-router + ant-design 后台管理系统配置

    首先确认安装了node环境,Node >= 6. 如果对react 及 ant-design 一无所知,建议去阅读下api文档,react 可以在 codePen 在线练习. react Api ...

  7. react新特性 react hooks

    本文介绍的是react新特性react hooks,本文面向的是有一定react开发经验的小伙伴,如果你对react还不是很熟悉的话我建议你先学习react并多多联系. 首先我们都知道react有3种 ...

  8. WHAT IS THE DIFFERENCE BETWEEN REACT.JS AND REACT NATIVE?

    Amit Ashwini - 09 SEPTEMBER 2017 React.js was developed by Facebook to address its need for a dynami ...

  9. 七天接手react项目 系列 —— react 脚手架创建项目

    其他章节请看: 七天接手react项目 系列 react 脚手架创建项目 前面我们一直通过 script 的方式学习 react 基础知识,而真实项目通常是基于脚手架进行开发. 本篇首先通过 reac ...

随机推荐

  1. 【转】Multithreaded Python Tutorial with the “Threadworms” Demo

    The code for this tutorial can be downloaded here: threadworms.py or from GitHub. This code works wi ...

  2. (转)javascript中return的作用

    这里面的return含有一些细节知识: 例如:onClick='return add_onclick()'与 onClick='add_onclick()'的区别 JAVASCRIPT在事件中调用函数 ...

  3. 历史执行Sql语句性能分析 CPU资源占用时间分析

    SELECT     HIGHEST_CPU_QUERIES.PLAN_HANDLE,     HIGHEST_CPU_QUERIES.TOTAL_WORKER_TIME,     Q.DBID,   ...

  4. MD5加密类

    public class MD5Util { public static String getMD5(String s) { char hexDigits[] = {'0', '1', '2', '3 ...

  5. Linux下批量替换文件内容方法

    1:查找find . -type f -name "*.html"|xargs grep ‘yourstring’ 2:查找并替换find -name '要查找的文件名' | xa ...

  6. java关键字 (jdk6),各自的含义是什么?

    Abstract 抽象的 一个Java语言中的关键字,用在类的声明中来指明一个类是不能被实例化的,但是可以被其它类继承.一个抽象类可以使用抽象方法,抽象方法不需要实现,但是需要在子类中被实现. bre ...

  7. C++采用模板实现栈的方法

    今天又看了遍<effective C++>,手动实现了一下条款42中的栈,贴出来当博客的处女贴. 首先栈的声明如下,采用了模板传入类型,而栈的底层采用是个链表. // stack.h // ...

  8. ECSTORE 关于前台页面DIALOG的调用

    在需调用dialog的html页面中插入本段代码. link='<{link app=test ctl=site_test act=abc}>'; var dialog = new Dia ...

  9. centos 6.5网卡dhcp不能获得网关

    环境:vmware +centos6.5 添加两个虚拟网卡.一个自动获取ip(用于上网-桥接) 一个手动(与主机通信用于ssh-NAT).  因为自已手动改了一下ifcfg-eth0里面的HWADDR ...

  10. 转: ubuntu配置NFS,挂载开发板

    ====================================== 命令: 1. $sudo apt-get install nfs-kernel-server           (安装N ...