当前位置:网站首页>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
边栏推荐
- Copy constructor shallow copy and deep copy
- Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
- PHP efficiently reads large files and processes data
- 5-minute NLP: text to text transfer transformer (T5) unified text to text task model
- ◰ GL shadow map core steps
- Lock锁
- PostgreSQL列存与行存
- Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
- Public variables of robotframework
- org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
猜你喜欢
Nacos + aspnetcore + Ocelot actual combat code
NVIDIA graphics card driver error
文件操作《二》(5000字总结篇)
计组 | 【七 输入/输出系统】知识点与例题
Kunteng full duplex digital wireless transceiver chip kt1605 / kt1606 / kt1607 / kt1608 is suitable for interphone scheme
True math problems in 1959 college entrance examination
New project of OMNeT learning
Detailed explanation of the penetration of network security in the shooting range
Idea of batch manufacturing test data, with source code
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
随机推荐
Copy constructor shallow copy and deep copy
计组 | 【七 输入/输出系统】知识点与例题
Change the password after installing MySQL in Linux
feign报400处理
Summary of common websites
CentOS MySQL multi instance deployment
MySQL master-slave configuration under CentOS
About stream flow, write it down briefly------
freeCodeCamp----prob_ Calculator exercise
_ Mold_ Board_
Linux MySQL data timing dump
面试百分百问到的进程,你究竟了解多少
oracle 中快速获取表的列名列表
English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
Interface document yaml
How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
Milvus 2.0 质量保障系统详解
ByteVCharts可视化图表库,你想要的我都有
Detailed explanation of Niuke - Gloves
[markdown notes]