New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

generator-redux-component

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

generator-redux-component

React-Redux generator for app with feature folders

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

generator-redux-component

Yeoman generator for React-Redux component. The code is written using ES7, so you need Babel for polyfill.

Installing the generator

$ npm install -g generator-redux-component

Usage

Run generator

yo redux-component

Choose component type (Smart or Dump)

Smart component

Reducers use Imutabale.js for state. I also use createReducers function for reduce boilerplate code.

import Immutable, { Map, List } from 'immutable';

export default function createReducer(initialState, handlers) {
  return (state = initialState, action) => {
    let newState = state;
    if (!Map.isMap(state) && !List.isList(state)) {
      newState = Immutable.fromJS(state);
    }

    const handler = handlers[action.type];

    if (!handler) {
      return newState;
    }

    newState = handler(newState, action);

    if (!Map.isMap(newState) && !List.isList(newState)) {
      throw new TypeError('Reducers must return Immutable objects.');
    }

    return newState;
  };
}

Don't forget to import generated reducer for createStore function!

Dump component

The dump component use BEM by default. You can find createBEM function here

Keywords

FAQs

Package last updated on 28 Aug 2015

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