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
Install size
197 kB
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).

Try it out on RunKit

Documentation

  1. Action
  2. Reducer
  3. CombinableReducers

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 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.
  • FSA action may have error = true but this involves IF Statements inside reducers, so, developers tend to have separate cases via ACTION_SUCCESS and ACTION_ERROR.
  • Uncontrolled scaffolding growth.

Installation

npm install --save redux-fluent

Getting Started

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


const addTodo = createAction('@@todos | add');

const todosReducer = createReducer('@@todos')
  .case(addTodo)
  .then((state, { payload }) => state.concat(payload))

  .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 May 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