If you have been paying attention to Twitter past few weeks, you may have noticed the spiking rival between Redux and Mobx.
In fact quite some of them are recommending moving to Mobx from Redux, due to Redux's infamous boilerplate structure.
- But really, is Mobx the only choice? If we are using Mobx for the reactivity, why not just use vue?
- Reim https://reimjs.gitbook.io
- Reim.js is an (im)mutable state management library. Inspired by great libraries like Redux, but without boilerplate.
- What does that mean?
- Well, if you have used React / Redux / Unstated before, Reim will feel so familiar everything just works.
- Overview
- Reim builds upon 3 parts:
- 1. Store
- Store is for creating a state that exposes method setState for updating state
2 + 3. Subscribe / Connect + setState
- Side Effects
- Instead of having side effects bound to a single store, Reim provides http://npm.im/reim-task , which makes an async function hold a store to actively maintain its status
- Use with other frameworks
- Although Reim was built initially for React, it can also be used with other libraries easily.
- Vue
Rxjs / Angular
- React-specific: Sync react-router-v4
- It has always been really hard to sync router state with store, even for mature frameworks Redux and Mobx.
- For Reim, you just need:
来源: https://juejin.im/entry/5b7628176fb9a0098d5c81f5