Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Strongly-typed collection of tools to make your Redux workflow more dynamic.

License

NotificationsYou must be signed in to change notification settings

kettanaito/redux-dynamics

Repository files navigation

Package versionBuild StatusCoverage StatusDependencies Status

redux-dynamics

Strongly-typed collection of useful tools to make yourRedux workflow more dynamic.

Features

Reducers

  • No hugeswitch statements!
  • state is always immutable
  • action is always immutable
  • context shared between all subscriptions
  • Declarative reducer subscriptions to the actions
  • Encouraging pure resolver functions
  • Support ofRegExp as the expected action type

Getting started

Install

NPM:

npm install redux-dynamics --save

Yarn:

yarn add redux-dynamics

Create a reducer

// ./store/comments/index.jsimport{Reducer}from'redux-dynamics';/* Create a new reducer with initial state */constreducer=newReducer({likes:0});/* Subscribe to different actions */reducer.subscribe('ADD_LIKE',(state,action,context)=>{/* Note how both "state" and "action" are immutable */constnextLikes=state.get('likes')+action.get('amount');/* Resolve the next state */returnstate.set('likes',nextLikes);});reducer.subscribe('ACTION_TYPE',(state,action,context)=>state);exportdefaultreducer;

Connect to Redux

// ./store/reducer.jsimport{createReducer}from'redux';importcommentsReducerfrom'./comments';exportdefaultcreateReducer({/* Convert "Reducer" class into pure reducer function */comments:commentsReducer.toFunction()});

Documentation

For more details on methods, usage examples and troubleshootingsee the Documentation.

Contributing

Feel free to submit your ideas on enhanced Redux workflow by issuing aPull request.

In case you have discovered a bug, outdated documentation or any other mismatch, pleasecreate a new Issue.

License

This library is licensed underMIT license.

About

Strongly-typed collection of tools to make your Redux workflow more dynamic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp