File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Given an action that returns a function, delegates its call
3
+ * to the function itself by passing the control of the dispatching,
4
+ * otherwise simply dispatch the action.
5
+ * In other words, it allows to have async actions.
6
+ *
7
+ * @param {Function } getState - allow to access the current state
8
+ * @return {Function } a new middleware
9
+ */
1
10
export default function thunkMiddleware ( getState ) {
2
11
return ( next ) => {
3
12
const recurse = ( action ) =>
Original file line number Diff line number Diff line change 1
1
import mapValues from '../utils/mapValues' ;
2
2
3
+ /**
4
+ * Given a list action creators, wrap them to the `dispatch` function
5
+ * in order to be automatically dispatched when invoked.
6
+ *
7
+ * @param {Object } actionCreators - an object with the action functions
8
+ * @param {Function } dispatch
9
+ * @return {Object } the given object with wrapped actions
10
+ */
3
11
export default function bindActionCreators ( actionCreators , dispatch ) {
4
12
return mapValues ( actionCreators , actionCreator =>
5
13
( ...args ) => dispatch ( actionCreator ( ...args ) )
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Given a React component, return its name to be displayed.
3
+ *
4
+ * @param {React } Component
5
+ * @return {String } the name of the component
6
+ */
1
7
export default function getDisplayName ( Component ) {
2
8
return Component . displayName || Component . name || 'Component' ;
3
9
}
You can’t perform that action at this time.
0 commit comments