2022-03-18 Learning Record--React-General Components and Routing Components

ReactInside, the components are divided into: 一般组件and路由组件

  • For : if you don't pass propsa 一般组件value, you won't receive anything; what you pass, propsyou will receive anything.

One, 一般组件put componentsit in, 路由组件put pagesit ininsert image description here

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"

Guess you like

Origin blog.csdn.net/weixin_48850734/article/details/123638964