Socket
Book a DemoInstallSign in
Socket

redacs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redacs

experimental redux wannabe with reducers and actions combined

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Redacs

Experimental project to see what happens with redux if reducers and actions are combined into reducer actions.

Why?

Redux is great for complex application. When writing simpler applications though, I've found that there is often a one-to-one relationship between actions and reducers. This is an experiment to see what happens if we combine them into reducer actions.

Also, the name is quite funny.

Example

This is a simple reducer action that adds a todo:

const initialState = {
  todos: []
};

const store = createStore(initialState);

function addTodo(id, description, completed) {
  return function(state) {
    return Object.assign({}, state, { todos: [...state.todos, { id, description, completed });
  }
}

store.dispatch(addTodo(1, 'a new todo', false));

The interface for the store is the same as for redux so it should work with redux-react for example.

Keywords

flux

FAQs

Package last updated on 15 Feb 2016

Did you know?

Socket

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