Skip to content

[Proposal] Memo in another manner #100

Closed
@aralroca

Description

@aralroca

Problem

memo approach is enough understandable. However is not 100% elegant solution... Especially if you have more "wrappers" like connect, withRouter, or other HOC:

export default memo(
  connect(mapStateToProps, mapDispatchToProps)(MyComponent),
)

Proposal

I will propose to do it following components configurations as displayName, propTypes, defaultProps...

MyComponent.displayName = 'NameOfMyComponent';

Something like:

export default function MyComponent() {
/* ... */
}


MyComponent.memo  = true;

or

export default function MyComponent() {
/* ... */
}

MyComponent.memo  = (nextProps, prevProps) => { /* ... */ };

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