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

76

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

76

Lightweight wrapper of React + Router + Redux-saga for SPA development.

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

76

Lightweight (300 lines) wrapper of React + Redux + Router + saga for SPA development.

Ver Build Status Coverage Status npm download

Install

npm i -S 76

Usage

import { Application, Module } from '76';

const app = new Application('test-app');

const module = new Module('user-list', {
  initialState,
  selectors,
  reducers,
  watchers,
});

app.addModule(module);

app.setRouter(router);

app.start('#web-container', () => { console.log('app start success!'); })

How to write initialState, selectors, reducers, watchers of module?

  • initialState

initialState is the initial state of module, used to initial store of redux. It is a pure object.

const initialState = {
  domain: {
    users: [],
  },
  ui: {
    loading: false,
  },
};
  • selectors

selectors is used to select the data of module state.

const selectors = {
  getUserList: state => state.domain.users
};
  • reducers

reducers is a pure function transform old state to new state.

const reducers = {
  addUser: (state, user) => {
    // use immutable-helper
    return update(state, {
      domain: {
        users: {
          $push: [user],
        },
      },
    });
  },
  ...
};
  • watchers

watchers is the redux action with side-effect, see document of redux-saga.

const watchers = [{
  take: 'takeEvery',
  actions: 'addUserAsync',
  generator: function*(selectors, actions, { payload }) {
    // do something with effects.
  },
}];

TODO

  • Project website developed by 76.

License

ISC@hustcc.

FAQs

Package last updated on 02 Jan 2018

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