- react-activation
- 官方中文文档
实例:
背景:需要缓存一个页面的状态(因为想保留该页面内某些步骤切换的状态)
技术: umi^3.3.7、react17.x
实现:
- 安装
npm install react-activation@^0.94 uuid@^8.3.2 umi-plugin-keep-alive@0.0.1-beta.26
2.在该页面引入
import { KeepAlive } from react-activation
const TestPage = () => {
return <div></div>
}
export default () => (
<KeepAlive name="/TestPage.html" saveScrollPosition="screen">
<TestPage/>
</KeepAlive>
)