当前位置:网站首页>1-5 类式组件
1-5 类式组件
2022-07-28 22:08:00 【画不完的饼】
类式组件
<script type="text/babel" > /* 此处一定要写babel */
//创建类式组件
//类式组件注意点
//1.必须继承React.Component这个父类
//2.必须写render函数
//3.必须有return返回值
class MyComponent extends React.Component{
//render是放在类的原型对象上的,供实例使用。
render(){
return <h2>我是用于复杂组件的定义</h2>
}
}
ReactDOM.render(<MyComponent/>,document.getElementById('test'))
/*
1.React解析组件标签,找到了MyComponent组件
2、发现组件是使用类定义的,随后new出来该类的实例,并通过该实例调用原型上的render方法。
3,将render返回的虚拟DOM转为真实DOM,随后呈现在页面中。
*/
</script>
边栏推荐
- Briefly introduce the working principle and characteristics of block cipher encryption block link mode (cryptography shift cipher encryption and decryption)
- Leetcode 763. partition labels divide alphabetic intervals (medium)
- (22杭电多校二)Two Permutation (dp),Package Delivery (贪心)
- 剑指 Offer 64. 求1+2+…+n,逻辑运算符短路效应
- 酪氨酸脱羧酶丨Worthington粪链球菌酪氨酸脱羧酶的特征
- 【MySQL 8】Generated Invisible Primary Keys(GIPK)
- SAP oracle 复制新实例后数据库远程连接报错 ora-01031
- Js判断数据类型的4种⽅式
- Multi sensor fusion positioning (II) -- map based positioning
- Working principle of fastdfs (technical principle)
猜你喜欢

【C】atoi和offsetof的介绍和模拟实现

SAP 临时表空间错误处理

Leetcode60. 排列序列

PowerCLi 批量添加esxi到vCenter

Tyrosine decarboxylase -- characteristics of tyrosine decarboxylase of Streptococcus faecalis in Worthington

Deep analysis of integrated learning AdaBoost

Solve thread safety problems & singleton mode

Hyperparametric optimization (grid search and Bayesian Optimization)

Multisensor fusion positioning (III) -- inertial technology

编译原理研究性学习专题 2——递归下降语法分析设计原理与实现
随机推荐
NAT如何配置地址转换
剑指 Offer 41. 数据流中的中位数
Worthington丨Worthington胰蛋白酶化学性质及相关研究
DevOps在物联网解决方案中的应用
基因组 DNA 分离丨Worthington核糖核酸酶A
【详细超简单】如何使用WebSocket链接
Js判断数据类型的4种⽅式
Apple's official website is being updated to maintain the apple store. Products such as the iPhone 13 / pro of the Bank of China will enjoy a maximum discount of 600 yuan
剑指 Offer 64. 求1+2+…+n,逻辑运算符短路效应
VirtualLab基础实验教程-8.傅里叶变换(1)
Codeforces Round #474 (Div. 1 + Div. 2) - C, F
Codeforces Round #810 (Div. 2) A - C
Urease -- Characteristics and determination scheme of Worthington jack bean urease
通配符 SSL/TLS 证书
【CNN】为什么CNN的卷积核大小一般都是奇数
ISO 13400(DoIP)标准解读
小程序editor富文本编辑使用及rich-text解析富文本
E-commerce data model design
Worthington核糖核酸酶B历史和化学性质说明
Jincang database kingbasees client Programming Interface Guide - ODBC feature support constraints