DEV Community

namgonado
namgonado

Posted on • Updated on

React MVC Store, Reducer, Controller all in one

I have created a React library to help front-end developers build React application with stores, reducers and controllers patterns. This is a pure React library, lightweight and easily adaptable to any current React based application. It doens't introduce any new technology but utilize the built-in React core functions to ensure the performance and integrity of React Framework.

If you were a fan of traditional MVC architect, then you won't be able to resist going ahead with "trendy" Flux pattern, a front-end architect by Facebook that focusing in unidirectional data flow. You probably get familiar with view, action, dispatcher, store and also reducer in Redux, another version of Flux. Redux in recent years has gained popularity as the de facto partner for many React applications.

However there is still an open question regarding Flux & Redux patterns: where is the Controller? You may see different answers depending on people's point of view, but the common information is that the Controllers don't have good place in the store - reducers pattern like Redux, they are unnecessary. Still, it was an unsatisfactory answer.

React-controducer not only provides stores, reducers, but it can also fill that gap by bringing Controllers into the store-reducer cycle and centralizing the management of React view components. If you're familiar with the Redux syntax, the controller will give you the same effect but with React's native rules.

Features

  • Define configurable stores across application
  • Define Reducers and Actions set for each store
  • Define Controllers that can "consume" one or many stores and processing data for React components group
  • Define Duty, an independent executable unit that can be called from anywhere in the application
  • Built-in Hooks for store, controllers, duties

Document

Top comments (0)