QuizNot attempted
Name the pattern
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Decorator
- A decorator wraps something to add behaviour while keeping the same interface, and an HOC takes a component and returns a component.
- Not Adapter: an adapter changes the interface to fit another one.
- Not Facade: a facade hides a whole subsystem behind a simpler API.
- Not Proxy: a proxy controls access to the same object (lazy load, cache, validate) rather than layering features.
- Middleware and
withLogging(fn)are decorators too.