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. 安装php 带debug

    gdb安装包   在CentOS6.4下使用gdb进行调试的时候, 使用bt(breaktrace)命令时,会弹出如下的提示: 头一天提示: Missing separate debuginfos, ...

  2. [原]Unity3D深入浅出 - GUI控件

    Unity的GUI类提供了丰富的界面控件,通过组合这些控件,完成和用户交互的界面. Lable:绘制文本和图片 Box:绘制一个图形框 Button:绘制一个响应单击事件的按钮 RepeatButto ...

  3. 通过autofac教你彻底明白依赖解耦(二)理论结合实践 - 大侠.Net

    上节说了一下基本的理论知识,例子可能不太好,不过无所谓了,目的是要让大家明白啥是依赖倒置和依赖注入,目的就达到了,简单一句话,这2玩意都是用来解耦合的. 不过依赖倒置这个词哥哥真不敢苟同,哥哥来个颠覆 ...

  4. Java Web程序工作原理

    Web开发的最重要的基本功能是HTTP:Java Web开发的最重要的基本功是Servlet Specification.HTTP和Servlet Specitication对于Web Server和 ...

  5. QTP检查点和参数化_百度一下

    一.脚本编辑检查点: Browser("百度知道 - 全球最大中文互动问答平台").Page("百度知道 - 全球最大中文互动问答平台").WebEdit(&q ...

  6. Jmeter性能测试之如何写Java请求测试用例类

    一. 引言: 最近工作中的一个项目要求做性能测试,该项目由提供服务的几个应用组成,选用的框架是阿里巴巴公司开源的服务框架Dubbo.关于Dubbo的介绍,网上也有很多资料,本人只是做了粗略的了解,没有 ...

  7. Ubuntu上搭建Watir-Webdriver与Cucumber环境

    本文主要演示如何在Ubuntu上搭建Watir-Webdriver与Cucumber环境,用于自动化测试. 1. Ubuntu环境 A. 安装 因为我的工作机是Windows,所以采用虚拟机的方式使用 ...

  8. 设计模式_Decorator_装饰模式

    形象例子: Mary过完轮到Sarly过生日,还是不要叫她自己挑了,不然这个月伙食费肯定玩完,拿出我去年在华山顶上照的照片,在背面写上“最好的的礼物,就是爱你的Fita”,再到街上礼品店买了个像框(卖 ...

  9. 解决JSP页面无法使用EasyUI里面class="easyui-dialog"的问题

    当使用MyEclipse新建一个JSP页面的时候,MyEclipse会自动添加一些标记,这些标记也许不一定会在工程中使用到.比如<base href="<%=basePath%& ...

  10. 傲游浏览器4,傲游浏览器5如何一键批量打开url链接。

    傲游浏览器批量打开网址的插件没用了.有很多网友发了方法也无法实现.实际上,是可以实现傲游浏览器4,傲游浏览器5一键批量打开url链接的.我来告诉大家如何来实现.最新的M5都能使用.在收藏夹添加一个收藏 ...