react-stamp icon indicating copy to clipboard operation
react-stamp copied to clipboard

Automatically setting displayName for a component

Open danielkcz opened this issue 8 years ago • 1 comments

Just an idea, I'm not sure if it doesn't collide with something else at this point, but what about defining component like this:

const MyComponent = () => ({
    render() {
    }
});
export default ReactStamp.compose(
    MyComponent, Focusable, Emittable
);

It means that it would have to call passed function to a compose to obtain a descriptor. Along the way it would be possible to read displayName of that function and append into final descriptor. I also like it this way as final composition is more readable.

danielkcz avatar Jul 05 '16 13:07 danielkcz

I am definitely on board with automatically setting displayName. Feel free to propose changes in a PR.

troutowicz avatar Jul 11 '16 03:07 troutowicz