DEV Community

namgonado
namgonado

Posted on • Edited 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

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay