当前位置:网站首页>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"]
})边栏推荐
猜你喜欢

1-11Vmware虚拟机常见的问题解决
![Making 3D romantic cool photo album [source code attached]](/img/81/68a0d2f522cc3d98bb70bf2c06893a.png)
Making 3D romantic cool photo album [source code attached]

Modelsim simulation FFT core cannot be simulated solution (qsys)

Establish a j-link GDB cross debugging environment for Px4

案例:绘制Matplotlib动态图

Atlas200dk brush machine

Download and install flume

Redisson 3.17.4 发布

Blob

FreeRTOS+STM32L+ESP8266+MQTT协议传输温湿度数据到腾讯云物联网平台
随机推荐
How to design the product roadmap?
C # operate with MySQL
【系统架构】-什么是MDA架构、ADL、DSSA
Atlas200dk刷机
Megacli common command collation
FPGA notes -- implementation of FPGA floating point operation
Preordered clue binary tree
How product managers control the progress of product development
Example: use C # Net to teach you how to develop wechat official account (21) -- using wechat to pay online collection: H5 method
Ad20 (Altium designer) PCB highlight network
C IO stream (I) basic concept_ Basic definition
制作3D浪漫炫酷相册【附源码】
[机缘参悟-30]:鬼谷子-内揵篇-同理心,站在对方的立场,拉近与对方的心理距离
What training brings happiness
Data synchronization
STL tutorial 5-basic concepts of STL and the use of string and vector
jarvisoj_level2_x64
Methods of modifying elements in JS array
. Net using access 2010 database
DPVS fullnat mode deployment