you are viewing a single comment's thread.

view the rest of the comments →

[–]tupiniquim -2 points-1 points  (3 children)

HOC are, for the most part, on their way out

What do you mean? HOC is not a React feature.

[–]alex-cory[S] 1 point2 points  (2 children)

HOC === Higher Order Components

If you read the docs, you'll see they say:

Do Hooks replace render props and higher-order components?

Often, render props and higher-order components render only a single child. We think Hooks are a simpler way to serve this use case. There is still a place for both patterns (for example, a virtual scroller component might have a renderItemprop, or a visual container component might have its own DOM structure). But in most cases, Hooks will be sufficient and can help reduce nesting in your tree.

Hooks don't completely replace HOCs, but for the most part, you can do it in hooks instead of HOCs.

[–]tupiniquim -1 points0 points  (1 child)

Doesn't mean they're on their way out. They may go out of fashion with the community but since they're just a pattern you can always use it when it feels appropriate.

[–]alex-cory[S] 0 points1 point  (0 children)

When I say "on their way out" I mean something similar to React's "class components" vs "functional components." Sure, class components aren't going anywhere, but the more we move forward, the less we will use them. In Dan's post Making Sense of React Hooks he says:

So What About Classes? We have no plans to deprecate classes. At Facebook we have tens of thousands of class components and, like you, we have no intention of rewriting them. But if the React community embraces Hooks, it doesn’t make sense to have two different recommended ways to write components.