react之基础篇3

it2025-04-28  18

一.组件间通信的两种方式

1.props方式

2.使用消息订阅–发布机制

订阅:绑定监听

发布:触发事件(发布事件) 3.redux

二.react-router

1.SPA

2.路由

npm i react-router-dom --save(使用的是web版本的) router:路由器(用来注册路由的) route:路由(是一个映射关系)

NavLink:类似a标签(存在一个属性:activeClassName用来设置样式类名) Switch:表示匹配其中的一个路由

3.嵌套路由

向路由组件传值

路由自带属性

在数组中,根据id查找对应的内容

5.2种路由跳转的方式

history.push()/history.replace()

三.react-ui之antd

1.国外:material-ui

2.国内:antd

(pc官网:https://ant.design/index.cn)

(移动官网:https://mobile.ant.design/index-cn)

github:https://github.com/ant-design/ant-design/

github:https://github.com/ant-design/ant-design-mobile/

最新回复(0)