When you're building your React components, you'll probably want to access child properties of the markup.

In Angular, it is transcludion:

<div>
<ng-transculde></ng-transclude>
</div>

In React, it is:

{this.props.children}

It means, use whatever pass in my component:

import React from 'react';

export default class App extends React.Component {
render() {
return (
<Button>I <Heart /> React</Button>
)
}
} class Button extends React.Component{
render() {
return (
<button>{this.props.children}</button>
)
}
} const Heart = () => <span>Love</span>;

So we pass <Heart /> into Button component, so in Button component, we use {this.user.props}

[React Fundamentals] Accessing Child Properties的更多相关文章

  1. [React] React Fundamentals: Accessing Child Properties

    When you're building your React components, you'll probably want to access child properties of the m ...

  2. [React Fundamentals] Introduction to Properties

    This lesson will teach you the basics of setting properties in your React components. class App exte ...

  3. [React] React Fundamentals: transferPropsTo

    the transferPropsTo method lets you easily push properties into your components to easily customize ...

  4. [React Fundamentals] State Basics

    State is used for properties on a component that will change, versus static properties that are pass ...

  5. [React] React Fundamentals: State Basics

    State is used for properties on a component that will change, versus static properties that are pass ...

  6. [React Fundamentals] Composable Components

    To make more composable React components, you can define common APIs for similar component types. im ...

  7. [React Fundamentals] Component Lifecycle - Updating

    The React component lifecycle will allow you to update your components at runtime. This lesson will ...

  8. [React Fundamentals] Component Lifecycle - Mounting Usage

    The previous lesson introduced the React component lifecycle mounting and unmounting. In this lesson ...

  9. [React Fundamentals] Component Lifecycle - Mounting Basics

    React components have a lifecycle, and you are able to access specific phases of that lifecycle. Thi ...

随机推荐

  1. Samba 'smbcacls'命令安全绕过漏洞

    漏洞版本: Samba 4.x 漏洞描述: Bugtraq ID:66232 CVE ID:CVE-2013-6442 Samba是一款实现SMB协议.跨平台进行文件共享和打印共享服务的程序. 当使用 ...

  2. xml 实现圆形图 和 椭圆形图

    1. 效果图 2.圆形图 <ImageView android:layout_width="wrap_content" android:layout_height=" ...

  3. POJ 3648 Wedding (2-SAT,经典)

    题意:新郎和新娘结婚,来了n-1对夫妻,这些夫妻包括新郎之间有通奸关系(包括男女,男男,女女),我们的目地是为了满足新娘,新娘对面不能坐着一对夫妻,也不能坐着有任何通奸关系的人,另外新郎一定要坐新娘对 ...

  4. c语言之extern关键字

    1.定义 extern,外面的.外来的意思.那它有什么作用呢?举个例子:假设你在大街上看到一个黑皮肤绿眼睛红头发的美女(外星人?)或者帅哥.你的第一反应就是这人不是国产的. extern就相当于他们的 ...

  5. Linux串口c_cc[VTIME]和c_cc[VMIN]属性设置的作用

    Linux串口c_cc[VTIME]和c_cc[VMIN]属性设置的作用 在串口编程模式下,open未设置O_NONBLOCK或O_NDELAY的情况下. c_cc[VTIME]和c_cc[VMIN] ...

  6. 《深入Java虚拟机学习笔记》- 第3章 安全

    3.1为什么需要安全性 Java的安全模型是其多个重要结构特点之一,它使Java成为适于网络环境的技术.因为网络提供了一条攻击连人的计算机的潜在途径,因此安全性是非常重要的.Java安全模型侧重于保护 ...

  7. 【Python】linux安装tornado

    想写个页面,又不想用tomcat,同事说可以用tornado,试一下 1 我从网上找了个hello world类似的程序,复制粘贴运行,提示 ImportError: No module named  ...

  8. Java String StringBuffer StringBuilder

    String  字符串常量存储在常量区,每次追加操作会创建新的对象: StringBuffer  字符串变量  线程安全 在堆上创建,每次追加操作在原对象上进行操作:  速度 StringBuffer ...

  9. ruby 资料整理

    http://blog.csdn.net/maingalaxy/article/details/46013393 http://blog.csdn.net/dzl84394/article/detai ...

  10. wuzhicms上传弹出层,如何返回数据到当前页面?

    我们要实现下面功能: 上传图片后,返回图片列表到页面: 点击开始上传后,自动返回结果到页面. 原理:通过openiframe打开上传弹出层. 其中: returntype 在这里是 2 www/res ...