Skip to content
Advertisement

Intellij WebStorm showing useless usage search on encapsulated React components (using HOC)

It is basically this issue.

While using code like

JavaScript

I can’t use search usages properly, because it obviously finds the export line.

It can be hacked in functional components like this:

JavaScript

but gets very ugly when using redux for example:

JavaScript

My questions are:

  • Is there a way to overcome this without using such ugly approach?
  • Is there a way to overcome this on a class component AT ALL?

Advertisement

Answer

It’s normal that you find only one ref for SomeComponent.

SomeComponent !== your default export

If you press right click on default and search there usages you find all that use it in import.

enter image description here

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement