Tag Archives: UmiJs

Using UMI plugin keep alive to realize keep alive state storage in UMI Ant Design

Using UMI plugin keep alive to store the keep alive state
1

$ npm install umi-plugin-keep-alive --save
//or
$ yarn add umi-plugin-keep-alive

2. Use

import { KeepAlive } from 'umi'
const contentList = () => {
	return (
		<>
			<KeepAlive 
				name="/About" //Can unload the <KeepAlive> node in the cached state by name
				saveScrollPosition="screen" //automatically saves the scroll position of the shared screen container
				when={true} > //true unloads when cached, false unloads when not cached
				<About/> //Component to save state for
			</KeepAlive>
		</>
	)
}

This function is based on react activation. For more details, please refer to react activation

[MAC] How to Solve zsh Error: command not found: umi

Global installation of UMI

$ tarn global add umi
$ umi -v
[email protected]

When running UMI - V times Zsh: command not found: UMI error, the solution is as follows:

1. Get global bin path

$ yarn global bin
/Users/*****/.yarn/bin

2. Run the open command to open. Bash_ Profile file

$ open ~/.bash_profile

3. In. Bash_ Add the following line to the profile file and save it

export PATH="YOUR global bin FLODER:$PATH"

4. Run the following command to make the modification effective

source ~/.bash_profile

5. Run again and solve the problem

$ umi -v
[email protected]