Skip to content

Instantly share code, notes, and snippets.

@collinalexbell
Created April 16, 2020 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save collinalexbell/7cd237c4e5ecddf3c950167977fc427d to your computer and use it in GitHub Desktop.
Save collinalexbell/7cd237c4e5ecddf3c950167977fc427d to your computer and use it in GitHub Desktop.
type Handler = (state: TableState, action: Action) => TableState
function composeHandlers(handlers: Handler[]): Handler {
return handlers.reduceRight(
(composed: Handler, next: Handler) =>
(state: TableState, action: Action): TableState => next(state, action));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment