Skip to content

Commit 63d4f54

Browse files
committed
Update readme
1 parent 3d04608 commit 63d4f54

File tree

1 file changed

+20
-42
lines changed

1 file changed

+20
-42
lines changed

README.md

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ yarn add redux-saves
1313

1414
### Usage
1515

16-
##### Add middleware
16+
#### Add middleware
1717
```typescript
1818
import { createStore, applyMiddleware } from 'redux'
1919
import { createSavesMiddleware } from 'redux-saves';
@@ -24,7 +24,7 @@ export const store = createStore(
2424
)
2525
```
2626

27-
##### Wrap Reducers
27+
#### Wrap Reducers
2828
Wrap each reducer that you want control with redux-saves
2929
```typescript
3030
import { savesReducerWrapper } from 'redux-saves';
@@ -54,7 +54,7 @@ export const reducer = savesReducerWrapper('Group 1', (state, action) => {
5454
5555
> If Group key don't specified, reducer will be added to default group;
5656
57-
##### Add Reducer with meta information from redux-saves (optional step)
57+
#### Add Reducer with meta information from redux-saves (optional step)
5858
```typescript
5959
import { createStore, applyMiddleware } from 'redux'
6060
import { createSavesMiddleware } from 'redux-saves';
@@ -70,9 +70,9 @@ export const store = createStore(
7070

7171
```
7272

73-
#### Actions
73+
### Actions
7474

75-
##### Add Save
75+
#### Add Save
7676
```typescript
7777
store.dispatch(createAddSaveAction());
7878
// or
@@ -83,21 +83,15 @@ type Payload = {
8383

8484
store.dispatch(createAddSaveAction(payload as Payload));
8585
```
86-
If payload === undefined || groupKeys === undefined
86+
+ if payload === undefined || groupKeys === undefined - groupKeys will equal for all existed groups
87+
+ if payload === undefined || saveKey === undefined - saveKey will generated automatically
8788

88-
  groupKeys will equal for all existed groups
89-
90-
If payload === undefined || saveKey === undefined
91-
92-
  saveKey will generated automatically
93-
94-
95-
##### Clear saves
89+
#### Clear saves
9690
```
9791
store.dispatch(createClearSavesAction());
9892
```
9993

100-
##### Remove saves
94+
#### Remove saves
10195
```typescript
10296
type Payload = {
10397
groupKeys?: TGroupKey[],
@@ -106,25 +100,19 @@ type Payload = {
106100
}
107101
store.dispatch(createRemoveSavesAction(payload as Payload));
108102
```
109-
If groupKeys === undefined
110-
111-
  groupKeys will equal for all existed groups
112-
113-
If isArray(saveKeys)
114-
115-
  redux-saves remove only this saves
103+
+ if groupKeys === undefined - groupKeys will equal for all existed groups
116104

117-
If isArray(exceptSaveKeys)
105+
+ if isArray(saveKeys) - redux-saves remove only this saves
118106

119-
  redux-saves all saves except this saves
107+
+ if isArray(exceptSaveKeys) - redux-saves all saves except this saves
120108

121109
> Don't use saveKeys and exceptSaveKeys at the same time
122110
123-
##### Load
111+
#### Load
124112

125113
> Redux-saves create AutoSaves if you try to load some save and at the same time you have unsaved changes in reducers;
126114
127-
##### Load save
115+
#### Load save
128116
```typescript
129117
type Payload = {
130118
groupKeys?: TGroupKey[],
@@ -136,37 +124,27 @@ If groupKeys === undefined
136124

137125
  groupKeys will equal for all existed groups
138126

139-
##### Load previous save
127+
#### Load previous save
140128
```typescript
141129
type Payload = {
142130
groupKeys?: TGroupKey[],
143131
count?: number // Count of back steps
144132
}
145133
store.dispatch(createLoadPrevSaveAction(payload as Payload));
146134
```
147-
If groupKeys === undefined
148-
149-
  groupKeys will equal for all existed groups
150-
151-
if count === undefined
152-
153-
  count will equal 1
135+
+ if groupKeys === undefined - groupKeys will equal for all existed groups
136+
+ if count === undefined - count will equal 1
154137

155-
##### Load next save
138+
#### Load next save
156139
```typescript
157140
type Payload = {
158141
groupKeys?: TGroupKey[],
159142
count?: number // Count of forward steps
160143
}
161144
store.dispatch(createLoadNextSaveAction(payload as Payload));
162145
```
163-
If groupKeys === undefined
164-
165-
  groupKeys will equal for all existed groups
166-
167-
if count === undefined
168-
169-
  count will equal 1
146+
+ if groupKeys === undefined - groupKeys will equal for all existed groups
147+
+ if count === undefined - count will equal 1
170148

171149
*Few words how work Load prev and next:*
172150
*Underhood saves it's two-linked list, every save have link to prev and next save,*

0 commit comments

Comments
 (0)