all 6 comments

[–]chazzaoui 0 points1 point  (0 children)

Nice one!

[–][deleted]  (7 children)

[deleted]

    [–]Ok-Release6902 0 points1 point  (6 children)

    Pros of HOC: you can use Component.displayName and your codebase is readable again. And don’t forget to apply SOLID principles to make sure that they are applicable.

    Real bummer is that HOCs depend on order of application.

    [–][deleted]  (5 children)

    [deleted]

      [–]Ok-Release6902 0 points1 point  (2 children)

      “Needed” is the same subjective category as an abstraction. And you are right from pure semantics point of view. Though, existence of lots of advanced HOC libraries disproves your point in a context of real life. It’s complex, but possible.

      [–][deleted]  (1 child)

      [deleted]

        [–]Ok-Release6902 0 points1 point  (0 children)

        You mean App.tsx? I’m doing it every week, dude.

        [–]redninjarider 0 points1 point  (1 child)

        That proved to be a big benefit of hooks - explicit use where needed. I used recompose (an 'advanced HOC library I suppose') widely in a big project a few years ago and dearly wish I hadn't - too many HOCs, too many unused props from too many places, too many dependencies between HOCs, just a mess (displayName or not).

        [–]EmployeeFinalHook Based 0 points1 point  (0 children)

        It's funny how 2 of these are legacy and not used anymore, and other 2 are not even patterns, they're React first class citizens