当前位置:网站首页>1-6 state与绑定事件
1-6 state与绑定事件
2022-07-28 22:08:00 【画不完的饼】
React依赖包我已上传地址如下:https://download.csdn.net/download/weixin_39162041/86264167
<script type="text/babel" > /* 此处一定要写babel */
class Wather extends React.Component{
constructor(props){
//实例三大元素props
//1.继承过来的属性,必须调用super()
//2.state默认是一个空对象、
//3.给元素绑定事件要使用花括号。不要加小括号,尽量剑圣document.getElementById这种方法的使用
super(props)
this.state = {isHot:true}
}
render(){
return <h1 onClick={demo}>今天天气很{this.state.isHot ?'炎热':'凉爽'}</h1>
}
}
ReactDOM.render(<Wather/>,document.getElementById('test'))
function demo(){
console.log('被点击了');
}
</script>
边栏推荐
- Worthington -- Specification of Worthington trypsin inhibitor
- Working principle of fastdfs (technical principle)
- Hutool official website (is hutool easy to use)
- 多传感器融合定位(二)——基于地图的定位
- 剑指 Offer 55 - I. 二叉树的深度
- 简述分组密码的加密分组链接模式的工作原理及其特点(密码学移位密码加密解密)
- 失败率高达80%,数字化转型如何正确完成战略规划?
- Xss.haozi.me range details
- 脲酶丨Worthington杰克豆脲酶的特性及测定方案
- Compose 的声明式代码如此简洁?
猜你喜欢

宝塔 phpmyadmin未授权访问漏洞

The computer doesn't know what to uninstall, can't open the calculator, can't edit screenshots, can't open txt files, and so on

失败率高达80%,数字化转型如何正确完成战略规划?

What is a driver signature and how does the driver get a digital signature?

使用Pytorch快速训练网络模型

编译原理研究性学习专题 2——递归下降语法分析设计原理与实现

解决:Direct local .aar file dependencies are not supported when building an AAR.

Leetcode63. 不同路径 II

Pycharm new project

SAP oracle 复制新实例后数据库远程连接报错 ora-01031
随机推荐
使用Pytorch快速训练网络模型
小程序editor富文本编辑使用及rich-text解析富文本
NPDP考试需要携带什么?文具携带说明
Xss.haozi.me range details
多传感器融合定位(一)——3D激光里程计
(22) two permutation (DP), package delivery (greedy)
PowerCLi VMware vCenter 通过自建的PXE Server一键批量部署常规New-VM
实时数仓:滴滴的实时数仓落地实践
Leetcode61. 旋转链表
毕业三年之际写给可能迷茫的你我[转]
Class, leetcode919 -- complete binary tree inserter
解决:Direct local .aar file dependencies are not supported when building an AAR.
Best practices for migration of kingbasees v8.3 to v8.6 of Jincang database (2. Compatibility of kingbasees v8.3 and v8.6)
VMware VCSA 7.0 Install
猿人学第二十题
Compatibility description between kingbasees and Oracle (4. SQL)
Inspur clusterenginev4.0 remote command execution vulnerability cve-2020-21224
Codeforces Round #474 (Div. 1 + Div. 2) - C, F
The classic dual stack implementation queue, pay attention to the modification of the judgment conditions of traversing the stack.
Tyrosine decarboxylase -- characteristics of tyrosine decarboxylase of Streptococcus faecalis in Worthington