import { useMemo } from 'react' ; import { useDispatch } from 'react-redux' ; type ActionCreator = ( ... args : any ) => any ; export function useReduxAction < AC extends ActionCreator > ( actionCreator ) { const dispatch = useDispatch ( ) ; return useMemo ( ( ) => ( ... args ) => { dispatch ( actionCreator ( ... ( args as any [ ] ) ) ) ; } , [ actionCreator ] ) ; }