how to make mobx store in single spa application root-config to share data and state among all micro applications?

49 Views Asked by At

I am newbie in microfrontends. I am currently using single-spa framework.I have learnt micro frontend applications creation and integration but i am facing problems in sharing data,UI common components and state between micro applications.Can anyone explain these processes using mobx or any other solution or library?

I searched on youtube and google but i did not get anything.

1

There are 1 best solutions below

0
José Ramírez On

As stated by others, your question is too broad to cater an acceptable answer. Still, I'll volunteer this one.

The single-spa library (it is not a framework) has nothing to do with state, so there is no provision to that effect. What you can find in it, is mechanisms to pass props to your components.

Now, armed with this knowledge, you can start investigating how to share state between micro-frontends according to what's possible with your state management library. Remember that single-spa doesn't favor a particular framework or library so its concepts remain agnostic. Whether you use mobx, Redux, Svelte stores, Pinia or anything else, is out of the scope of single-spa.

Now, personally, I do Svelte and use Svelte stores. Stores can be passed via props, so it is very straightforward to share state between micro-frontends, even if they aren't Svelte because Svelte stores can be easily consumed from React, Vue, Solid or any other.