[React Fundamentals] Accessing Child Properties
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的更多相关文章
- [React] React Fundamentals: Accessing Child Properties
When you're building your React components, you'll probably want to access child properties of the m ...
- [React Fundamentals] Introduction to Properties
This lesson will teach you the basics of setting properties in your React components. class App exte ...
- [React] React Fundamentals: transferPropsTo
the transferPropsTo method lets you easily push properties into your components to easily customize ...
- [React Fundamentals] State Basics
State is used for properties on a component that will change, versus static properties that are pass ...
- [React] React Fundamentals: State Basics
State is used for properties on a component that will change, versus static properties that are pass ...
- [React Fundamentals] Composable Components
To make more composable React components, you can define common APIs for similar component types. im ...
- [React Fundamentals] Component Lifecycle - Updating
The React component lifecycle will allow you to update your components at runtime. This lesson will ...
- [React Fundamentals] Component Lifecycle - Mounting Usage
The previous lesson introduced the React component lifecycle mounting and unmounting. In this lesson ...
- [React Fundamentals] Component Lifecycle - Mounting Basics
React components have a lifecycle, and you are able to access specific phases of that lifecycle. Thi ...
随机推荐
- xml 实现圆形图 和 椭圆形图
1. 效果图 2.圆形图 <ImageView android:layout_width="wrap_content" android:layout_height=" ...
- 多线程程序设计学习(9)worker pattern模式
Worker pattern[工作模式]一:Worker pattern的参与者--->Client(委托人线程)--->Channel(通道,里边有,存放请求的队列)--->Req ...
- git参考书籍
Pro GIt 简体中文版 http://iissnan.com/progit/
- 如何使用ping和tracert命令测试网站访问速度
在我们平时访问的网站中,有一些网站访问速度非常快,比如百度搜索网站和一些门户网站,有些网站访问很慢,有些网站甚至无法访问.那么我们该如何判断这些网站的访问速度呢?下面我们就使用Windows的ping ...
- linux常识
一.linux常识 1.为什么学习linux及如何学习linux? 基于linux的操作系统是一种自由和开放源代码的类UNIX操作系统,其定义组件是linux内核,其稳定性.安全性.处理多并发已经得到 ...
- sys.argv[]基本用法
#python 3.4.2 #windows系统下可以在CMD下执行 python test.py 第一参数 第2个参数 #空格分隔每个参数,sys.argv[]是用来获取命令行参数的 #引用必要的包 ...
- 【转】shell中IFS用法
http://blog.itpub.net/27181165/viewspace-775820/ 一 IFS的介绍 Shell 脚本中有个变量叫IFS(Internal Field Seprato ...
- DNN学习
DNN(DotNetNuke)是一个免费.开源.可扩展的内容管理系统,可广泛用于商务网站.企业内网和外网网站.在线内容发布网站.DotNetNuke是微软第一次向开源说"Yes"的 ...
- Android应用正确使用扩展SD卡,特别是安卓4.4以后的版本
Android 开发时如何正确获取使用扩展存储路径 在 2.x 版本中,Android设备都是单存储,第三方App写文件,必须申请 WRITE_EXTERNAL_STORAGE 权限: 在4.0之后, ...
- NSArray和NSMutableArray的详解
数组中不能存放基本数据类型,必须存放对象,因此如果要存放基本数据类型,先进行NSTimer封装 NSArray的用法: 第一.初始化 NSArray *firstArray=[[NSArray all ...