[React Fundamentals] Introduction to Properties
2024-10-11 11:42:58
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')
);
最新文章
- [转] spring @Entity @Table
- LeetCode - Populating Next Right Pointers in Each Node II
- python中os/sys/platform模块区别
- (转)PHP ob_start() 函数介绍
- 重置CentOS 7的Root密码
- LeetCode Javascript实现 258. Add Digits 104. Maximum Depth of Binary Tree 226. Invert Binary Tree
- 【转载】假设有以下代码 String s = “hello”; 阿里巴巴笔试题
- 【JVM】深度分析Java的ClassLoader机制(源码级别)
- 十一.keepalived高可用服务实践部署
- 数独游戏 js
- swiper 父级元素display:none 之bug
- git 推送远程仓库和删除远程仓库文件
- eclipse中搭建ssm框架
- Java常用API、Math类介绍
- Python: 猴子分桃。海滩上有一堆桃子,五只猴子来分。
- python stdout 重定向
- CentOS 7 安装 caffe
- WPF中设置Border的BorderThickness属性会让背景图片产生模糊感
- [BZOJ2281][SDOI2011]黑白棋(K-Nim博弈)
- DOM简介
热门文章
- js实现对数据库的增删查改
- bzoj1433:[ZJOI2009]假期的宿舍
- 流行的MySql版本
- centos-nginx添加模块(无需重新编译)
- ejabberd中的http反向推送
- Java操作Hbase进行建表、删表以及对数据进行增删改查,条件查询
- algorithm@ find the shortest path in a graph using BFS
- HDU-4618 Palindrome Sub-Array 暴力枚举
- A Tour of Go Switch with no condition
- nyoj 6 喷水装置(一)