当前位置:网站首页>1-3 components and modules
1-3 components and modules
2022-04-23 16:59:00 【Endless cake】
Components and modules
modular
1. Providing specific functions to the outside world js Program , It's usually a separate js file
2. Why should it be disassembled into modules : With the increase of business , The code is getting more complicated
3. Reuse js, simplify js, Provide js efficiency
Components
1. A collection of code and resources used to achieve local functional effects (html/css/js/image) etc.
2. Used to improve the reuse rate of code , Simplify the code , Improve operational efficiency
Functional component
What to pay attention to :
1. Component initial must be uppercase
2. Function must have a return value
3. Labels must be used when using
<div id='text'></div>
// Functional component
function Demo() {
// Here this yes undefined, because babel It turns on strict mode . In strict mode, it is forbidden to this Point to window
console.log(this);
return <h2>sjsoj</h2>;
}
ReactDOM.render(<Demo />, document.getElementById("text"));
/*
Yes ReactDOM.render after .
1.react Resolved component label , eureka Demo Components
2. Then it is found that the component is defined by the function , Subsequent call function , The virtual machine that will be returned DOM, Then it appears on the page
*/
版权声明
本文为[Endless cake]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554519835.html
边栏推荐
- Introduction to new functions of camtasia2022 software
- 拷贝构造函数 浅拷贝与深拷贝
- 文件操作《二》(5000字总结篇)
- How much do you know about the process of the interview
- [markdown notes]
- VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
- Calculate pie chart percentage
- Detailed explanation of the penetration of network security in the shooting range
- Mock test
- Summary of common websites
猜你喜欢

MySQL master-slave synchronization pit avoidance version tutorial

On lambda powertools typescript

English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)

Grpc gateway based on Ocelot

ByteVCharts可视化图表库,你想要的我都有

Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin

Nodejs reads the local JSON file through require. Unexpected token / in JSON at position appears

DDT + Excel for interface test

计组 | 【七 输入/输出系统】知识点与例题

MySQL master-slave replication
随机推荐
Linux MySQL data timing dump
_ Mold_ Board_
Rtklib 2.4.3 source code Notes
An essay on the classical "tear down the wall in thinking"
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
Shortcut keys (multiline)
MySQL master-slave replication
groutine
Your brain expands and shrinks over time — these charts show how
Derivation of Σ GL perspective projection matrix
New keyword learning and summary
Nifi fast installation and file synchronization
Pytorch: the pit between train mode and eval mode
Milvus 2.0 質量保障系統詳解
Deepinv20 installation MariaDB
How to build tiktok user trust and drive fan growth
Encapsulating the logging module
织梦DEDECMS安全设置指南
New project of OMNeT learning
Detailed explanation of Milvus 2.0 quality assurance system