Skip to content

Bug: Anonymous component name in developer tool with run build but not run start #20805

@anaskiee

Description

@anaskiee

Components name are not displayed in developer tool in production environment (during tests). But they are in the local one launched with npm run start.
image

I configured webpack to to have almost the same behavior between two environments but I did not succeed to have the expected behavior.
It seems linked to the displayName property which is not set under "type".

production env
image

local env
image

React version: 17.0.1

Steps To Reproduce

You can reproduce the bug by using React.memo on an anonymous function and then set displayName on the output.

Example:

export default App = React.memo(() => {
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
    </div>
  );
});
App.displayName = "App";

Actually, the bug is probably that the displayName is not taken into account on memo by the react devtool. But since the object is not generated the same way in both environments, I'm not quite sure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions