Created
July 26, 2019 11:16
-
-
Save asherccohen/fc745663232d7a4d27a6c7c5bedd3150 to your computer and use it in GitHub Desktop.
LoadingSelector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const loadingSelector = (state, actions) => { | |
const types = actions.map(type => { | |
const matches = /(.*)_(REQUEST|SUCCESS|FAILURE)/.exec(type); | |
if (!matches) return type; | |
const [, requestName] = matches; | |
return requestName; | |
}); | |
return types.some(action => state.fetching[action]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment