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. bzoj题解

    bzoj1012 线段树水题 bzoj1207 LIS水题 bzoj2190 挡住,即 bzoj1601 已被删除的水题? bzoj1607 线段树细节题,搞清楚特判即可 bzoj1008 快速幂妥妥 ...

  2. 软件测试Web数据分析工具HttpWatch安装

    1.下载破解版:http://www.pc6.com/softview/SoftView_13845.html 2.安装时引入授权文件并汉化: 3.打开IE9,菜单:管理加载项->工具栏和扩展, ...

  3. 使用Zxing实现扫二维码描

    1.集成Zxing.bar 2.复制代码到项目中 3.修改 MipacActivityCapture.java  的扫描结果方法 handleDecode() /** * 处理扫描结果,实现活动页面跳 ...

  4. I.MX6 build.prop

    /************************************************************************ * I.MX6 build.prop * 说明: * ...

  5. wpa_supplicant是什么?

    /************************************************************************ * wpa_supplicant是什么? * 声明: ...

  6. Java [Leetcode 258]Add Digits

    题目描述: Given a non-negative integer num, repeatedly add all its digits until the result has only one ...

  7. 【转】UINavigationBar 使用总结

    原文网址:http://www.jianshu.com/p/f0d3df54baa6 UINavigationBar是我们在开发过程中经常要用到的一个控件,下面我会为大家介绍一些常用的用法. 1. 设 ...

  8. FZU 2127 养鸡场

     Problem Description Jason买来了n米长的竹篱笆,打算将n米长的竹篱笆全部用来围成一个三角形的养鸡场.为方便起见,养鸡场三条边的长度都为正整数.同时,他想让自己的养鸡场看起来更 ...

  9. 【安全】requests和BeautifulSoup小试牛刀

    web安全的题,为了找key随手写的程序,无处安放,姑且贴上来. # -*- coding: UTF-8 -*- __author__ = 'weimw' import requests from B ...

  10. 【Java基础】Java网络编程基础知识

    什么是网络编程 网络编程是通过使用套接字来达到进程间通信目的,那什么是套接字呢?其实套接字是支持TCP/IP的网络通信的基本操作单元,可以看做是不同主机之间的进程进行双向通信的端点,简单的说就是通信的 ...