React: Components not correctly displayed

Created on 8 Oct 2019  路  4Comments  路  Source: facebook/react

Do you want to request a feature or report a bug?

bug

What is the current behavior?

elements not reconized

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

only use components tab in console of chrome.

What is the expected behavior?

see any elements react

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Window 10 64bit
react ^16.8.1

image

This is my console component visualizzation, the same page visualizated with linux&chrome not have any issue

Developer Tools Question

Most helpful comment

Sunil is right. It looks like your screenshot above is showing a production build and the component function names have been managed/minified (e.g. MyComponent -> t). This is generally what you want as it makes the bundle smaller (so it's faster to download and parse).

The DEV build should always show the non-minified component names. If you want to see them in the production build, you could either:

  1. Disabling mangling. (How you do this would depend on what your build tooling is.)
  2. Use the displayName attribute.

I wouldn't really recommend doing either though, since both would make your app bundle larger.

All 4 comments

What exactly is the problem here? Is it the shortened component names? That seems like you鈥檙e viewing the component tree of an app in production mode (probably with minified code). Could you explain what you expected to see?

Sunil is right. It looks like your screenshot above is showing a production build and the component function names have been managed/minified (e.g. MyComponent -> t). This is generally what you want as it makes the bundle smaller (so it's faster to download and parse).

The DEV build should always show the non-minified component names. If you want to see them in the production build, you could either:

  1. Disabling mangling. (How you do this would depend on what your build tooling is.)
  2. Use the displayName attribute.

I wouldn't really recommend doing either though, since both would make your app bundle larger.

yes correct!!My error work in production!sorry

No problem. Thanks for clarifying.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zpao picture zpao  路  3Comments

jimfb picture jimfb  路  3Comments

huxiaoqi567 picture huxiaoqi567  路  3Comments

zpao picture zpao  路  3Comments

jvorcak picture jvorcak  路  3Comments