react-reduxredux-toolkitmobx

is there an analogue of 'counstuctor' mobx in redux-toolkit?


We have a store with an application theme We want to rewrite it in redux-toolkit Is there something similar to "constructor" in redux-toolkit so that multiple functions can be called sequentially when creating a store? enter image description here

I looked through many sites but could not find a solution to my question


Solution

  • No.

    Just write it after configureStore:

    const store = configureStore(...)
    store.dispatch(..)
    store.dispatch(..)
    store.dispatch(..)
    

    and if you need to create stores multiple times (probably only ever in SSR scenarios, usually you should have one store per running application, so in the browser: one), wrap all of that in a function.