React
Inside, the components are divided into: 一般组件
and路由组件
- For : if you don't pass
props
a 一般组件
value, you won't receive anything; what you pass, props
you will receive anything.
One, 一般组件
put components
it in, 路由组件
put pages
it in
Second, the difference between routing components and general components
路由组件与一般组件
1.写法不同:
一般组件:<Demo/>
路由组件:<Route path="/demo" component={
Demo}/>
2.存放位置不同:
一般组件:components
路由组件:pages
3.接收到的props不同:
一般组件:写组件标签时传递了什么,就能收到什么
路由组件:接收到三个固定的属性
history:
go: ƒ go(n)
goBack: ƒ goBack()
goForward: ƒ goForward()
push: ƒ push(path, state)
replace: ƒ replace(path, state)
location:
pathname: "/about"
search: ""
state: undefined
match:
params: {
}
path: "/about"
url: "/about"