首页 > 解决方案 > 打字稿扩展历史对象自定义状态属性

问题描述

import { history } from 'history';

history.push('my path', {
          someNewProperty: true
        });

然后当我尝试访问它时

history.location.state.someNewProperty

我有Object is of type 'unknown'.错误。如何将自定义添加someNewPropertyhistory.location.state

标签: javascriptreactjstypescriptreact-router

解决方案


推荐阅读