A meta reducer is a higher order reducer that allows you to take action on the global state rather than a state slice. In NGXS, we don't have this concept but you can accomplish this with plugins.
An example of a meta reducer might be to clear the entire state when a user logs out. An example implementation would be:
import { getActionTypeFromInstance } from'@ngxs/store';exportfunctionlogoutPlugin(state, action, next) {// Use the get action type helper to determine the typeif (getActionTypeFromInstance(action) ===Logout.type) {// if we are a logout type, lets erase all the state state = {}; }// return the next function with the empty statereturnnext(state, action);}