当前位置:网站首页>The cache page stores the initial parameters after the route jump under the react + router framework
The cache page stores the initial parameters after the route jump under the react + router framework
2022-06-26 00:58:00 【ivanfor666】
// The original can be used window.history.replaceState Save the initialization parameters of the current page , Even if the page is refreshed, it will not be lost .
// utilize props.history.push Jump to the normal page .
// But because in push It uses state It can only be used as a temporary parameter , Once the route jumps 、 Refresh 、 Forward 、 Back off, etc , All make state The loss of ,
// So we need to use native history To achieve .
if(!window["num"]){
window["num"] = 1
}
const appHistoryPush = (pathname,data,title?:string)=>{
// react-router Of history
props.history.push(pathname)
// Native history
history.replaceState(data,title)
}
appHistoryPush({pathname:"yourPathname"},{
yourPathname:"yourPathname"+window["num"]
})边栏推荐
- 4 key points to help the product manage the project well
- Qt之自定义带游标的QSlider
- Making 3D romantic cool photo album [source code attached]
- Preordered clue binary tree
- The maze of God's perspective in robot vision
- Typescript for Web Learning
- Mining pit record of modified field information in Dameng database
- Sqlserver is case sensitive
- Optimized three-dimensional space positioning method and its fast implementation in C language
- 随便画画的
猜你喜欢

C # operate with MySQL

学习识别对话式问答中的后续问题

使用VS2022編譯Telegram桌面端(tdesktop)

JS逆向案例:破解登录密码

mtb13_ Perform extract_ blend_ Super{candidate (primaryalternate) \u unique (nullable filtering \foreign\index\granulati

About the use of hc-12 radio frequency module

C#使用MySql进行操作

Analyze the five root causes of product development failure

"Method not allowed", 405 problem analysis and solution

Flink报错:Error: A JNI error has occurred, please check your installation and try again
随机推荐
Solve STM32 operation μ Solution to sudden failure of task scheduling in c/os-ii system
QT custom QSlider with cursor
react + router 框架下的路由跳转后缓存页面存初始参数
C # operate with MySQL
[从零开始学习FPGA编程-44]:视野篇 - 集成电路助力数字化时代高质量发展-1-集成电路芯片主要形态
Things / phenomena / things / things / situations / appearances
Stream data
Redisson 3.17.4 release
AD20(Altium Designer) PCB 高亮网络
Web学习之TypeScript
每日一问:线程和进程的区别
ASP. Net cache cache usage
Leetcode 513. Find the value in the lower left corner of the tree
11.1.2 overview of Flink_ Wordcount case
MySQL custom function instance
Kylin
Chapter VI exercises (678) [microcomputer principles] [exercises]
How to design the product roadmap?
Establish a j-link GDB cross debugging environment for Px4
Comprehensive introduction to Simulink solver