当前位置:网站首页>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
边栏推荐
- Lock锁
- File upload and download of robot framework
- 无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
- Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
- ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
- Generate random numbers with high quality and Gaussian distribution
- ByteVCharts可视化图表库,你想要的我都有
- 【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”
- Go language, array, string, slice
- Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
猜你喜欢
如何建立 TikTok用户信任并拉动粉丝增长
Shell script -- shell programming specification and variables
Project framework of robot framework
Smart doc + Torna generate interface document
Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
Dlib of face recognition framework
[PROJECT] small hat takeout (8)
STM32__ 03 - beginner timer
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
随机推荐
文件操作《二》(5000字总结篇)
feign报400处理
PHP高效读大文件处理数据
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation
Lock锁
Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
Nifi fast installation and file synchronization
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
计算饼状图百分比
Dlib of face recognition framework
Public variables of robotframework
Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
Interface document yaml
扫码登录的原理你真的了解吗?
Read a blog, re understand closures and tidy up
Getting started with JDBC
Use case labeling mechanism of robot framework
Installation and management procedures