Socket
Socket
Sign inDemoInstall

redux-fluent

Package Overview
Dependencies
0
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redux-fluent

Tiny and eloquent way to manage a redux-like state manager


Version published
Maintainers
2
Created

Readme

Source

Redux Fluent Logo Redux Fluent

npm version Build Status npm downloads Code Climate Test Coverage npm version

Tiny and eloquent way to manage a redux-like state manager (3K, dependencies free, definitions included).

Motivation

Redux is great, every recent web application was most likely been built on top of it, however we really think we can simplify it further and after our investigation we came out with:

  • Reducers usually tend to grow and become hard to maintain, 'cause of the amount of switch-cases.
  • Concepts such as Action, Action Type and Action Creator could be squashed into only one.
  • The push towards the standards should be stronger.

Installation

To install the stable version:

npm install --save redux-fluent

Usage

/** todosReducer.js **/
import { createAction, createReducer } from 'redux-fluent';


const addTodo = createAction('@@todos | add');
const addTodoTask = (state, { payload }) => ({ 
  ...state, 
  list: state.list.concat(payload),
});

const todosReducer = createReducer('@@todos')
  .case(addTodo)
  .then(addTodoTask)
  
  .default()
;

export { todosReducer, addTodo };
/** application.js **/
import { createStore, combineReducers } from 'redux';
import { createCombinableReducers } from 'redux-fluent';
import { otherReducer } from './otherReducer';
import { todosReducer, addTodo } from './todosReducer';


const reducers = combineReducers(
  createCombinableReducers(todosReducer, otherReducer),
);

const store = createStore(reducers);

// You can think of `addTodo` as an action creator itself
store.dispatch(
  addTodo({
    id: 1,
    title: 'Walk Gipsy',
  }),
);

Keywords

FAQs

Last updated on 22 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc