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.

Commit297fb36

Browse files
committed
Update README and Reducer.spec.js
1 parent7c0353f commit297fb36

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

‎LICENSE‎renamed to ‎LICENSE.md‎

File renamed without changes.

‎README.md‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
![Dependencies Status](https://david-dm.org/kettanaito/redux-dynamics.svg)
55

66
#redux-dynamics
7-
Strongly-typed collection of usefulmethods andtools to make your[Redux](http://redux.js.org/) workflow more dynamic.
7+
Strongly-typed collection of useful tools to make your[Redux](http://redux.js.org/) workflow more dynamic.
88

99
##Features
1010
###Reducers
@@ -13,8 +13,8 @@ Strongly-typed collection of useful methods and tools to make your [Redux](http:
1313
*`action` is always immutable
1414
*`context` shared between all subscriptions
1515
* Declarative reducer subscriptions to the actions
16-
*Encouragement of pure resolver functions
17-
*`RegExp` as expected action type
16+
*Encouraging pure resolver functions
17+
*Support of`RegExp` as the expected action type
1818

1919
##Getting started
2020

@@ -33,32 +33,36 @@ yarn add redux-dynamics
3333
###Create a reducer
3434

3535
```js
36-
// store/comments/index.js
36+
//./store/comments/index.js
3737
import {Reducer }from'redux-dynamics';
3838

3939
/* Create a new reducer with initial state*/
4040
constreducer=newReducer({
4141
likes:0
4242
});
4343

44-
/* Subscribe toaction types*/
45-
reducer.subscribe('ADD_LIKES', (state,action,context)=> {
46-
/* Notethat both "state" and "action" are immutable*/
44+
/* Subscribe todifferent actions*/
45+
reducer.subscribe('ADD_LIKE', (state,action,context)=> {
46+
/* Notehow both "state" and "action" are immutable*/
4747
constnextLikes=state.get('likes')+action.get('amount');
4848

4949
/* Resolve the next state*/
5050
returnstate.set('likes', nextLikes);
5151
});
52+
53+
reducer.subscribe('ACTION_TYPE', (state,action,context)=> state);
54+
55+
exportdefaultreducer;
5256
```
5357

5458
###Connect to Redux
5559
```js
56-
// store/reducer.js
60+
//./store/reducer.js
5761
import {createReducer }from'redux';
5862
importcommentsReducerfrom'./comments';
5963

6064
exportdefaultcreateReducer({
61-
/* Convert "Reducer" class into pure function*/
65+
/* Convert "Reducer" class into purereducerfunction*/
6266
comments:commentsReducer.toFunction()
6367
});
6468
```
@@ -72,4 +76,4 @@ Feel free to submit your ideas on enhanced Redux workflow by issuing a [Pull req
7276
In case you have discovered a bug, outdated documentation or any other mismatch, please[create a new Issue](https://github.com/kettanaito/redux-dynamics/issues).
7377

7478
##License
75-
This library is licensed under[MIT license](./LICENSE).
79+
This library is licensed under[MIT license](./LICENSE.md).

‎test/createReducer.spec.js‎renamed to ‎test/Reducer.spec.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ reducer.subscribe('ADD_COMMENT', (state, action, context) => {
1515
/* Create a new Redux store */
1616
conststore=createStore(reducer.toFunction());
1717

18-
describe('Create reducer',()=>{
18+
describe('Reducer',()=>{
1919
it('Library exports are fine',()=>{
2020
returnexpect(Reducer).to.not.be.undefined;
2121
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp