Skip to content

React Developer Tools no display name problem #141

@deathmood

Description

@deathmood

Got the problem with stateless components. As you suggest here, I've just wrapped component declaration into observer(..) function like this:

export const MyButton = observer( ({ param }) => (  
   <div>......</div>
));

but that breaks up displayName of this component. So I see smth like this (without observer(...) displayName is displayed properly):

image

for now, first solution that I see is to export default

const MyButton = ({ param }) => (  
   <div>......</div>
);

export default observer(MyButton);

But then I'm able to export only one thing from module. Other way is to create two variables like MyButton and then export const MyButtonObserver = observer(MyButton) --- but that is unpleasant complication(((

Is there any other way to fix this? Should this be reflected in docs?

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