[React Fundamentals] Introduction to Properties
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的更多相关文章
- [React Fundamentals] Accessing Child Properties
When you're building your React components, you'll probably want to access child properties of the m ...
- [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] State Basics
State is used for properties on a component that will change, versus static properties that are pass ...
- [React] React Fundamentals: transferPropsTo
the transferPropsTo method lets you easily push properties into your components to easily customize ...
- [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 ...
随机推荐
- linux 上下文切换带来的影响
1.保存CPU寄存器中的内容 2.CPU高速缓存中的内容失效 3.重新装载页表,用于给线程程安装一个新的虚拟地址空间,页表缓存失效
- BZOJ2140: 稳定婚姻
题解: 题意就是求二分图的必须边. 我们有结论: 在残量网络上跑tarjan,对于一条边(u,v) 如果该边满流||scc[u]==scc[v],那么该边是可行边. 因为如果scc[u]==scc[v ...
- android.util.AndroidRuntimeException: requestFeature() must be called before adding content 错误解决方法
Activity全屏,网上的代码如下:protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstance ...
- Azure HDInsight HBase DR解决方案
Sun wei Sat, Feb 28 2015 3:07 AM Apache HBase是目前非常流行的NoSQL数据库,通过HDFS+Zookeep+Master+Region Server的架 ...
- C# 中的 null
原文 C# 中的 null C# 允许将 null 值赋给任意引用变量(不能把 null 赋给一个值变量).值为 null 的变量表明该变量不引用内存中的任何对象. 如下所示: Circle c = ...
- Python日期时间函数处理
所有日期.时间的 api 都在datetime模块内. 1 日期的格式化输出 datetime => string import datetime now = datetime.datetime ...
- 《零成本实现Web自动化测试--基于Selenium》 第五章 Selenium-RC
一. 简介 Selenium-RC可以适应更复杂的自动化测试需求,而不仅仅是简单的浏览器操作和线性执行.Selenium-RC能够充分利用编程语言来构建更复杂的自动化测试案例,例如读写文件.查询数据库 ...
- 单元测试工具之Xunit
在.NET开发中的单元测试工具之——xUnit.Net 原始出处 http://zhoufoxcn.blog.51cto.com/792419/1172320 在上一篇<在.NET开发中的单元 ...
- Windows mysql 5.6 zip 安装 并创建用户赋予数据库权限
1.下载mysql 5.6 zip 首先下载mysql 5.6 zip (在官网(http://www.mysql.com/downloads/) 或者其他网站都行), 然后解压在自己的电脑上 D:\ ...
- 多线程与网络之cookies
1. 网络请求中的cookie 1.1 删除cooki NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCook ...