Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

aliasing assemble as compose is misleading #4

@atomanyih

Description

@atomanyih

recompose's compose allows you to compose any HoC (or function for that matter)

Transitioning from recompose to reassemble is actually more complicated because of this

If you have code that looks like this in recompose

import {withProps, compose} from 'recompose';
const enhance = compose(
  withProps(whatever),
  customHOC,
);

It's reasonable to expect this to work in reassemble

import {withProps, compose} from 'reassemble';

const enhance = compose(
  withProps(whatever),
  customHOC,
);

Instead you have write this:

import {compose} from 'recompose'; // or lodash or whatever
import {withProps, assemble} from 'reassemble';

const enhance = compose(
  assemble(
    withProps(whatever)
  ),
  customHOC
);

I think that assemble shouldn't be aliased as compose — it's nice in theory but is problematic if you're transitioning from a codebase with recompose and a lot of custom HoC

It's also not clear at first glance why it is failing; in our case it throws up some propType errors and doesn't render properly. It would be easier to understand if it could throw an error or print a warning if you pass a non-composable to assemble


btw thanks for making this library! I love recompose, but the devtool ballooning problem has kept me from using it more extensively. I've already converted a number of HoC in our codebase to use reassemble

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions