M
M
maksmaksimovich2018-08-27 13:11:42
JavaScript
maksmaksimovich, 2018-08-27 13:11:42

What is the difference between higher-order components and decorators?

What is the difference between higher order components and decorators?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2018-08-27
@maksmaksimovich

In simple words..
A decorator is a function that takes another function (let's call it "basic") as input and returns a third function that calls/uses the base one under its hood.
HOC is a special case of a decorator when the underlying function is a React component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question