Despite defining a name for our higher-order component, the name gets lost in the DevTools.
This isn't some problem inherent to HOCs themselves. The problem is in how HOC is defined. If it doesn't a class/function with a name... well, you know the rest. :-)
So you can totally write a HOC that adds a reasonable name, just follow the same suggestions you already wrote, but for the returned class itself.
I am a software developer currently working as a consultant. I work primarily in Javascript, React, and RxJS. I am always trying to learn new languages and frameworks.
Along with trying to help others, this post is just as much for me to see how well I understand a topic. I really appreciate that you took the time to read my post and offer up such helpful feedback because it not only improves the post, but it improves my knowledge on the topic.
I follow a lot of topics around React and Redux, so having you personally respond to this post blows my mind! Something I wouldn't have ever expected, so thank you again!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
To clarify some points.
The problem isn't with "exporting component directly". The problem is that you didn't give it a name.
Your code looks like this:
The class doesn't have a name. If you give it a name this won't be a problem (even though you still "export it directly"):
This isn't some problem inherent to HOCs themselves. The problem is in how HOC is defined. If it doesn't a class/function with a name... well, you know the rest. :-)
So you can totally write a HOC that adds a reasonable name, just follow the same suggestions you already wrote, but for the returned class itself.
Dan,
Along with trying to help others, this post is just as much for me to see how well I understand a topic. I really appreciate that you took the time to read my post and offer up such helpful feedback because it not only improves the post, but it improves my knowledge on the topic.
I follow a lot of topics around React and Redux, so having you personally respond to this post blows my mind! Something I wouldn't have ever expected, so thank you again!