Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading