Skip to content

Commit 97d2cde

Browse files
authored
Create nodeJsNote
1 parent 293f415 commit 97d2cde

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

nodeJsNote

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
browser.js 编译JSX
2+
react.js React核心库
3+
react-dom.js React操作DOM库
4+
5+
1. JSX可以直接创建组件--直接写组件的HTML
6+
创建出来的是组件--不是HTML标签
7+
8+
2. 有且仅有一个父级
9+
10+
3. class -> className
11+
for -> htmlFor
12+
13+
_________________________________________
14+
15+
1. 所有组件必须继承自React.Component
16+
2. 必须:
17+
a.有constructor和super
18+
b.首字母必须大写
19+
c.一定要有render()
20+
3.传参: {xxx}
21+
22+
__________________________________________
23+
24+
1. for和if可以使用JS自带的语法
25+
2. {}:可以向HTML输出,也可以向属性输出
26+
3. 组件传参:
27+
接收参数:this.props => 所有属性
28+
4. this.props: 只读
29+
this.state: 可修改(一旦改变,页面就会重新渲染组件,类似于vue的data)
30+
this.普通属性: 没用
31+
32+
5. React可变的一般是state
33+
a. 初始化-constructor
34+
this.state = {...};
35+
b. 修改:
36+
this.setState({
37+
xxx:...
38+
})
39+
c. 使用:
40+
this.state.xxx
41+
6. 事件:
42+
onClick = {this.fn.bind(this)}
43+
7. 组件间通信--Redux
44+
1.父级->子级 属性
45+
2.子级->父级 方法
46+
47+
node -v
48+
npm -v
49+
cd [workspace]
50+
npm init
51+
npm install left-pad --save
52+
node index.js
53+
54+
https://www.taniarascia.com/how-to-install-and-use-node-js-and-npm-mac-and-windows/
55+
56+
项目结构:
57+
1. src 源文件(index.js:入口JS文件)
58+
2. public 静态文件(index.html:入口html文件)
59+
60+
61+
npx create-react-app project-name
62+
cd project-name
63+
npm start
64+
或:
65+
1. 安装
66+
npm i -g create-react-app
67+
2. 创建项目
68+
create-react-app 名字
69+
3. 运行项目
70+
npm start

0 commit comments

Comments
 (0)