Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-entities

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-entities

Higher-order reducer for store entities received from gaearon's normalizr and makes it easy to handle them.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

Redux Entities

build status npm version

Higher-order reducer for store entities received from gaearon's normalizr and makes it easy to handle them.

Installation

npm install --save redux-entities

Usage

WIP

Use with entitiesReducer

import { combineReducers } from 'redux';
import { entitiesReducer } from 'redux-entities';
import omit from 'lodash/object/omit';

function contacts(state = {}, action) {

    const { type, /* , payload */ meta } = action;

    switch (type) {

    case UPDATE_CONTACT:
    case REMOVE_CONTACT:
        return Object.assign({}, state, { [payload.id]: {
            ...state[payload.id],
            isPending: true
        } });

    case UPDATE_CONTACT_SUCCESS:
        return Object.assign({}, state, { [payload.id]: {
            ...state[payload.id],
            isPending: false
        } });

        // return merge({}, state, { [meta.id]: { isPending: false } });

    case REMOVE_CONTACT_SUCCESS:
        return omit(state, meta.id);

    default:
        return state;
    }
}

export default combineReducers({
    contacts: entitiesReducer(contacts, 'contacts')
});

Use with combineEntitiesReducers

import { combineEntitiesReducers } from 'redux-entities';
import { contacts, groups, images, notes } from './entities'

export default combineEntitiesReducers({
    contacts,
    groups,
    images,
    notes
});

Keywords

FAQs

Package last updated on 04 Jun 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc