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

class App extends React.Component {
render(){
let txt = this.props.txt
return <h1>{txt}</h1>
}
} App.propTypes = {
txt: React.PropTypes.string,
cat: React.PropTypes.number.isRequired
} App.defaultProps ={
txt: 'this is the default txt'
} ReactDOM.render(
<App cat={5} />,
document.getElementById('app')
);

[React Fundamentals] Introduction to Properties的更多相关文章

  1. [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] React Fundamentals: Accessing Child Properties

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

  3. [React Fundamentals] State Basics

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

  4. [React] React Fundamentals: transferPropsTo

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

  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. vijos1067守望者的逃离

    裸的矩阵乘法,我却调了一上午……弱到爆啊…… 不过最终辛苦没有白费,我终于彻底搞懂了 要注意几点: 一.必须构造出前几项 二.用矩阵乘法算法之后还要手工算答案,利用首先算好的前几项 三.想好自己构造的 ...

  2. LeetCode Product of Array Except Self (除自身外序列之积)

    题意:给一个序列nums,要求返回一个序列ans,两序列元素个数相同,ans第i个元素就是除了nums[i]之外所有的数相乘之积. 思路:时间O(n),额外空间O(0). 第一次扫一遍,处理nums[ ...

  3. 【转】C/C++中可变参数函数的实现

    转自:http://www.cnblogs.com/cylee025/archive/2011/05/23/2054792.html 在C语言的stdarg.h头文件中提供了三个函数va_start, ...

  4. FireFox、chrome通过插件使用IE内核,IE Tab v2

    fireFox 插件管理中  搜索IE tab  找到ieTab v2 安装后,添加网站规则就可以用. chrome 去ietab.net 下载 *.crx文件,  打开插件管理界面, 拖拽 *.cr ...

  5. 【windows核心编程】 第六章 线程基础

    Windows核心编程 第六章 线程基础 欢迎转载 转载请注明出处:http://www.cnblogs.com/cuish/p/3145214.html 1. 线程的组成 ①    一个是线程的内核 ...

  6. as3+java+mysql(mybatis) 数据自动工具(四)

    现在介绍一下只配置 as3 与 java 公用的数据类,这种配置一般是该数据类只需要在 as3 与 java 之间转换,跟数据库没有关系.比如在客户端与服务端的数据交换中,需要定义一个统一返回请求的数 ...

  7. 多线程之RunLoop

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  8. 深入浅出 JavaScript 数组 v0.5

    有一段时间不更新博客了,今天分享给大家的是一篇关于JS数组的,数组其实比较简单,但是用法非常灵活,在工作学习中应该多学,多用,这样才能领会数组的真谛. 以下知识主要参考<JS 精粹>和&l ...

  9. leetcode@ [79/140] Trie树应用 Word Search / Word Search II

    https://leetcode.com/problems/word-search/ class Solution { public: struct Trie{ Trie *next[]; bool ...

  10. Visual Studio C++ Command Line

    最近在Visual Studio 2012进行vp8的开发,之前一直都是在ubuntu上进行开发,关于编译链接的一些选项可直接在makefile中定义,比如vp8的头文件都放在include文件下面, ...