Skip to content

Commit 14e2ff5

Browse files
committed
Add note on reducer/dispatcher power feature.
1 parent 7c2c282 commit 14e2ff5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,14 @@ Callback function invoked when a promise rejects, receives rejection reason (err
377377

378378
> `function(state: any, action: Object, internalReducer: function(state: any, action: Object))`
379379
380-
State reducer to take full control over state updates by wrapping the internal reducer. It receives the current state,
381-
the dispatched action and the internal reducer. You probably want to invoke the internal reducer at some point.
380+
State reducer to take full control over state updates by wrapping the [internal reducer]. It receives the current
381+
state, the dispatched action and the internal reducer. You probably want to invoke the internal reducer at some point.
382+
383+
> This is a power feature which loosely follows the [state reducer pattern]. It allows you to control state changes by
384+
> intercepting actions before they are handled, or by overriding or enhancing the reducer itself.
385+
386+
[internal reducer]: https://github.com/ghengeveld/react-async/blob/master/src/reducer.js
387+
[state reducer pattern]: https://kentcdodds.com/blog/the-state-reducer-pattern
382388

383389
#### `dispatcher`
384390

@@ -388,6 +394,9 @@ Action dispatcher to take full control over action dispatching by wrapping the i
388394
original action, the internal dispatcher and all component props (or options). You probably want to invoke the internal
389395
dispatcher at some point.
390396

397+
> This is a power feature similar to the [state reducer pattern]. It allows you to control state changes by
398+
> intercepting actions before they are dispatched, to dispatch additional actions, possibly later in time.
399+
391400
#### `defer`
392401

393402
> `boolean`

0 commit comments

Comments
 (0)