react高阶组件——withRouter

withRouter是高阶组件,可以通过 withRouter 获取到 history、location、match 对象。

js 复制代码
import { withRouter } from 'umi';

export default withRouter(({ history, location, match }) => {
  return (
    <div>
      <ul>
        <li>history: {history.action}</li>
        <li>location: {location.pathname}</li>
        <li>match: {`${match.isExact}`}</li>
      </ul>
    </div>
  );
});
相关推荐
林恒smileZAZ2 小时前
Vue<前端页面版本检测>
前端·javascript·vue.js
码事漫谈5 小时前
当AI开始“思考”:我们是否真的准备好了?
前端·后端
许杰小刀5 小时前
ctfshow-web文件包含(web78-web86)
android·前端·android studio
我是Superman丶6 小时前
Element UI 表格某行突出悬浮效果
前端·javascript·vue.js
恋猫de小郭6 小时前
你的代理归我了:AI 大模型恶意中间人攻击,钱包都被转走了
前端·人工智能·ai编程
xiaokuangren_6 小时前
前端css颜色
前端·css
Huanzhi_Lin6 小时前
关于V8/MajorGC/MinorGC——性能优化
javascript·性能优化·ts·js·v8·新生代·老生代
hoiii1877 小时前
C# 基于 LumiSoft 实现 SIP 客户端方案
前端·c#
anOnion7 小时前
构建无障碍组件之Meter Pattern
前端·html·交互设计
小码哥_常7 小时前
Spring Boot配置diff:解锁配置管理新姿势
前端