When using React redux in RN, what is the good way to reset state to exit the screen?

introduced React-redux, into RN, but now a problem has been found:

after I enter a screen and do some operations, the corresponding state of the screen changes, exits and enters again. Since the state in store has not been reset, the state after the last operation is still there (for example, a prompt or picture that should not be displayed in the initial state)

how to solve this problem? How can I show the initial state of the screen every time I enter the screen?

see someone say that the action that resets the state is sent in the component"s life cycle function: componentWillUnmount.
this does solve the problem, but is there a more elegant way? This practice is fine when the number of pages is small, but if there are a large number of pages, it really doesn"t feel like a good idea. And a lot of Action has been added out of thin air.

is there any middleware or plug-in in the redux family bucket that can solve this problem?

Mar.04,2021

More

pages don't mean you have more store branches. Just empty each store branch, which won't be too many.

if there is such a middleware, it is necessary to specify the initial value of store and artificially set the trigger time of the middleware, so it is still a question whether it can be simpler than Action

.

uses inheritance, and all interfaces inherit a BaseComponent , which resets all states in componentWillUnmount of this BaseComponent .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33d44-2bead.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33d44-2bead.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?