Reim 不是另一个「Redux」

阅读 235
收藏 9
2018-08-17
原文链接:medium.com

Why Reim is not another Redux

An (im)mutable state management library, simply awesome


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

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


Hopefully I’ve convinced at least some of you to have a deep look at Reim. Feel free to check out the docs, and raise issues for even more improvements :)

评论