Skip to content

Connect throws an error when connecting a memoized component #1061

Closed
@Maushundb

Description

@Maushundb

After upgrading my project to React 16.6.0 and migrating components to React.memo instead of Recompose.pure, connect is throwing an error when passed a memoized component:

Uncaught Error: You must pass a component to the function returned by connect. Instead received {"compare":null}

Repro:

const mapStateToProps = () => ({});
const MyComponent = React.memo(() => <div />);
const MyConnectedComponent = connect(mapStateToProps)(MyComponent);
ReactDOM.render(
  <MyConnectedComponent />,
  document.getElementById('root'),
);

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