Is there a Redux(Global State) alternative for Capacitor apps

I am starting with mobile app, but I came from react native development, I am trying to apply my previous experience here, so I have questions, this time, I need to know how to manage a global state of my application(like redux does)

how we can manage the auth token storage + user information and other data I should need over my app.

Sorry if there’s already a tutorial about all this, if you have one, please share with me, so I can follow the best practices on this.

We have several components that allows you to store information locally. You can use something like the value component to store information, but you can also have your own JavaScript logic.

Here the counter example from Redux. In the subscribe you just set the state in the global scope from App Connect. You can then have an expression like {{counter.value}} which will automatically update when the state changes.

Example uses the Redux UMD package.

function counterReducer(state = { value: 0 }, action) {
  switch (action.type) {
    case 'counter/incremented':
      return { value: state.value + 1 }
    case 'counter/decremented':
      return { value: state.value - 1 }
    default:
      return state
  }
}

// Create a Redux store for the state
let store = Redux.createStore(counterReducer)

// Put the state in the App Connect global scope
// The state is now everywhere in the app
// via expressions under `counter` available
dmx.global.set('counter', store.getState())

// Subscribe to updates
store.subscribe(() => {
  dmx.global.set('counter', store.getState())
})

// we can now update the state using the dispatch
store.dispatch({ type: 'counter/incremented' })