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

11.1.1 overview of Flink_ Flink overview

STL tutorial 5-basic concepts of STL and the use of string and vector

Motor monitoring system based on MCGS and stm32

Atlas200dk brush machine

1-11solutions to common problems of VMware virtual machine

CXF

使用VS2022編譯Telegram桌面端(tdesktop)
![Chapter V exercises (124, 678, 15, 19, 22) [microcomputer principles] [exercises]](/img/16/d67f38d32af6904a7d0be9f2e5be70.png)
Chapter V exercises (124, 678, 15, 19, 22) [microcomputer principles] [exercises]

关于HC-12无线射频模块使用

Qt优秀开源项目之九:qTox
随机推荐
How product managers control the progress of product development
Permission design = function permission + Data permission
Mining pit record of modified field information in Dameng database
Blob
Ad20 (Altium designer) PCB highlight network
事物/现象/事情/东西/情况/表象
react + router 框架下的路由跳转后缓存页面存初始参数
CXF
Establish a j-link GDB cross debugging environment for Px4
Kylin
Endnote IEEE Transactions on industrial electronics/tie/tpel reference format template
Summary of push-pull output and open drain output of STM32 and failure of analog IIC driving mlx90615
ASP.NET cache缓存的用法
Implementation notes of least square fitting conic in stm32
Msp430f5529lp official board (red) can not debug the problem
Atlas200dk brush machine
C#另外一个new类的方式Ico?以及App.config的使用
模板引擎——FreeMarker初体验
Leetcode 513. Find the value in the lower left corner of the tree
QT excellent open source project 9: qtox