-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add displayName to composers #140
base: master
Are you sure you want to change the base?
Conversation
@@ -11,6 +11,6 @@ export function inheritStatics(Container, ChildComponent) { | |||
// If not, just add a default one. | |||
'ChildComponent'; | |||
|
|||
Container.displayName = `Container(${childDisplayName})`; // eslint-disable-line | |||
Container.displayName = `${displayName}(${childDisplayName})`; // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we set: Container.displatName = displayName
And I think this even possible: Container = compose(...)
Container.displayName = 'something'; Are we trying to something else here? |
It works well for components and containers, not for composers. The following works: Component = ...
Container.displayName = 'something';
Container = compose(myFn)(Component)
Container.displayName = 'something'; The following doesn't: Component = ...
WithRedux = compose(myFn)
WithRedux.displayName = 'something'; // useless
WithTracker = compose(myFn)
WithTracker.displayName = 'something'; // useless
Composer = merge(
WithRedux,
WithTracker
)
Composer.displayName = 'something'; // useless
Container = Composer(Component) When using |
But you could do this: const Container = merge(
WithRedux,
WithTracker
)(Component);
Container.displayName = 'something'; |
Yes, I could. As I said, it works well for components and containers, not for composers. In your example there will be a |
Okay. I am good to take this. |
Problem
I can't define the display-name of the middle container in some cases, having to stick with a
MyContainer -> Container(MyComponent) -> MyComponent
pattern.Solution
Inspired by react-komposer-plus, the goal is to be able to define the display-name in the composers, as seen here. The pattern would then become
MyContainer -> withRedux(MyComponent) -> MyComponent
.