Skip to content

Instantly share code, notes, and snippets.

@davemackintosh
Last active September 27, 2019 13:30
Show Gist options
  • Select an option

  • Save davemackintosh/22f6331b505361f2f9bbd8b23ec7f9a8 to your computer and use it in GitHub Desktop.

Select an option

Save davemackintosh/22f6331b505361f2f9bbd8b23ec7f9a8 to your computer and use it in GitHub Desktop.

Revisions

  1. davemackintosh revised this gist Sep 27, 2019. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions hoc-composer.jsx
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,10 @@
    function compose(...composable) {
    return composable.reduceRight((children, Composable) => {
    return <Composable>{children}</Composable>
    }, "")
    return (component) =>
    composable.reduceRight((children, Composable) => {
    return <Composable>{children}</Composable>
    }, component)
    }

    // compose(withRouter, withMyHOC, withYourHOC)(MyComponent)

    export default compose
  2. davemackintosh created this gist Sep 27, 2019.
    7 changes: 7 additions & 0 deletions hoc-composer.jsx
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    function compose(...composable) {
    return composable.reduceRight((children, Composable) => {
    return <Composable>{children}</Composable>
    }, "")
    }

    export default compose