当前位置:网站首页>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"]
})边栏推荐
- Flink报错:Error: A JNI error has occurred, please check your installation and try again
- Why is it best to use equals for integer comparisons
- DPVS fullnat mode deployment
- Solve STM32 operation μ Solution to sudden failure of task scheduling in c/os-ii system
- mongodb
- 1-9network configuration in VMWare
- Web學習之TypeScript
- ADC acquisition noise and comparison between RMS filter and Kalman filter
- 事物/现象/事情/东西/情况/表象
- Send mail tool class
猜你喜欢

CXF

1-11Vmware虚拟机常见的问题解决

Installation and startup of redis

Endnote IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS/TIE/TPEL 参考文献格式模板

QT excellent open source project 9: qtox

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

Web學習之TypeScript

模板引擎——FreeMarker初体验

FreeRTOS+STM32L+ESP8266+MQTT协议传输温湿度数据到腾讯云物联网平台

C IO stream (II) extension class_ Packer
随机推荐
Solve STM32 operation μ Solution to sudden failure of task scheduling in c/os-ii system
How product managers control the progress of product development
Motor monitoring system based on MCGS and stm32
Stream data
debezium
渗透工具-Burpsuite
Flex & Bison 开始
关于EF翻页查询数据库
[image detection] vascular tracking and diameter estimation based on Gaussian process and Radon transform with matlab code
Optimized three-dimensional space positioning method and its fast implementation in C language
Mining pit record of modified field information in Dameng database
Flex & bison start
Qt优秀开源项目之九:qTox
ciscn_2019_en_2
sqlserver 区分字符串中字母大小写
[system architecture] - what are MDA architecture, ADL and DSSA
mongodb
Redisson 3.17.4 release
Openresty chapter 01 introduction and installation configuration
Android cache usage tool class