reactjs - (替换 & 之间有什么区别) 在反应路由器中
问题描述
在 react-router (Redirect) 和 props.history.replace 中,它们执行相同的过程,当我按下返回页面时,我没有得到上一页,它们都是相同的,为了解决这个问题,我使用 push ,但为什么它们是一样的(替换 & )
解决方案
将历史视为堆栈数据结构。
TDLR栈是如何工作的以及push和replace的区别
const history = ['/login']
// history.push("/dashboard") ['/login', '/dashboard']
// history.replace('/dashboard') ['/dashboard']
// history.pop() []
推荐阅读
- google-apps-script - 使用 Google Docs API 插入方程式
- string - Redshift :- 易于将逗号分隔的字符串拆分为行
- c++ - 形式参数“板”的重新定义
- pip - “conda install pip” 更改 python 版本。如何避免这种情况?
- gcc - 无法将“布尔”转换为“NEDElement*”
- python - python中访问json类型数据的问题
- python - 在python中解码windows证书序列号
- c++ - 脱离时出现 ImGui Vulkan 验证层错误
- javascript - 检查类是否包含所有数组项?
- gitlab - 不允许合并 GitLab-CI 中的特定分支