-
Notifications
You must be signed in to change notification settings - Fork 45.5k
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
Bug: Devtools shows Anonymous for memoized function components #17876
Comments
I think I found a workaround. If you do |
I would not recommend mutating const SomeComponent = React.memo(function SomeComponent(){
// ...
}) forking your example - https://codesandbox.io/s/laughing-rgb-v0puv-c0nc5 This could be enforced with an eslint rule (similarly for Closing since this is expected behaviour. |
@threepointone We use and its also have a problem of typescript is the type defintion look like allow set Please consider it, Please! |
So did anyone fix the issue? I still see all Anonymous components when inspected. :( |
Do you still see if you do the below?
|
Still happening in 2022. and still the same solution /**
* Set display name for the component so it's easily debuggable.
* the memo method prevents the FC from being named
*/
SomeComponent.displayName = 'SomeComponent'; |
React version: 16.12.0
React dev tools version: 4.4.0
Steps To Reproduce
The current behavior
Component's name in devtools is Anonymous, I've seen adding a displayName work in the past but it does not anymore.
The expected behavior
Name of component in devtools should be the set displayName.
The text was updated successfully, but these errors were encountered: