Last active
May 17, 2022 14:40
-
-
Save hypest/9c8facebc1655122934778ec7d721860 to your computer and use it in GitHub Desktop.
Gutenberg Redux action logger
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
function createSimpleLogger( storeName ) { | |
return ( store ) => ( next ) => ( action ) => { | |
const result = next( action ); | |
console.log( { | |
storeName, | |
action, | |
result, | |
} ); | |
return result; | |
}; | |
} | |
// Then in instantiateReduxStore, add to middlewares | |
function instantiateReduxStore( key, options, registry, thunkArgs ) { | |
... | |
const middlewares = [ | |
... | |
createSimpleLogger( key ), | |
]; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment