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')
);

最新文章

  1. [转] spring @Entity @Table
  2. LeetCode - Populating Next Right Pointers in Each Node II
  3. python中os/sys/platform模块区别
  4. (转)PHP ob_start() 函数介绍
  5. 重置CentOS 7的Root密码
  6. LeetCode Javascript实现 258. Add Digits 104. Maximum Depth of Binary Tree 226. Invert Binary Tree
  7. 【转载】假设有以下代码 String s = “hello”; 阿里巴巴笔试题
  8. 【JVM】深度分析Java的ClassLoader机制(源码级别)
  9. 十一.keepalived高可用服务实践部署
  10. 数独游戏 js
  11. swiper 父级元素display:none 之bug
  12. git 推送远程仓库和删除远程仓库文件
  13. eclipse中搭建ssm框架
  14. Java常用API、Math类介绍
  15. Python: 猴子分桃。海滩上有一堆桃子,五只猴子来分。
  16. python stdout 重定向
  17. CentOS 7 安装 caffe
  18. WPF中设置Border的BorderThickness属性会让背景图片产生模糊感
  19. [BZOJ2281][SDOI2011]黑白棋(K-Nim博弈)
  20. DOM简介

热门文章

  1. js实现对数据库的增删查改
  2. bzoj1433:[ZJOI2009]假期的宿舍
  3. 流行的MySql版本
  4. centos-nginx添加模块(无需重新编译)
  5. ejabberd中的http反向推送
  6. Java操作Hbase进行建表、删表以及对数据进行增删改查,条件查询
  7. algorithm@ find the shortest path in a graph using BFS
  8. HDU-4618 Palindrome Sub-Array 暴力枚举
  9. A Tour of Go Switch with no condition
  10. nyoj 6 喷水装置(一)