[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 ...
随机推荐
- CQOI2009中位数图
原来在vijos上做过,当时根本看不懂 现在看起来这么水…… x记录从b向左连续走比k大的有多少个 y记录从b向右连续走比k大的有多少个 最后根据乘法原理乘一下 不过要加上x[0]+y[0]+1 因为 ...
- css padding在ie7、ie6、firefox中的兼容问题
padding 简写属性在一个声明中设置所有内边距属性. 说明这个简写属性设置元素所有内边距的宽度,或者设置各边上内边距的宽度.行内非替换元素上设置的内边距不会影响行高计算:因此,如果一个元素既有内边 ...
- Java [Leetcode 292]Nim Game
问题描述: You are playing the following Nim Game with your friend: There is a heap of stones on the tabl ...
- 使用BusyBox制作嵌入式Linux根文件系统
STEP 1:构建目录结构 创建根文件系统目录,主要包括以下目录/dev /etc /lib /usr /var /proc /tmp /home /root /mnt /bin /sbin ...
- Erlang入门(三)——分布式编程
明天要回家一个星期了,好好休息下.今天找到别人翻译的Erlang编程手册,值的好好读一遍. 所谓分布式的Erlang应用是运行在一系列Erlang节点组成的网络之上.这样的系统的性质与单一节点上 ...
- mycat分布式mysql中间件(数据库切分概述)[转]
mysql数据库切分 前言 通 过MySQLReplication功能所实现的扩展总是会受到数据库大小的限制,一旦数据库过于庞大,尤其是当写入过于频繁,很难由一台主机支撑的时 候,我们还是会面临到扩展 ...
- 021QTP之焦点(多思考)
一.什么是焦点: 焦点说白了就是你打开某一个程序时默认的focuse 比如我们那QTP自带的windows下的示例程序来说,启动它后焦点自动落在了agent name文本框上 二.利用Tab键检查焦点 ...
- API性能测试基本性能指标及要求
略 适用 Lifeix 所有后台应用. 1.事务(Transaction) 在web性能测试中,一个事务表示一个“从用户发送请求->web server接受到请求,进行处理-> web s ...
- iOS开发UI篇—实现一个私人通讯录小应用【转】
转一篇学习segue不错的教程 一.该部分主要完成内容 1.界面搭建 2.功能说明 (1).只有当账号和密码输入框都有值的时候,登录按钮才能交互 (2). ...
- Jquery UI的datepicker插件使用方法
原文链接;http://www.ido321.com/375.html Jquery UI是一个非常丰富的Jquery插件,并且UI的各部分插件可以独自分离出来使用,这是其他很多Jquery插件没有的 ...