Question · JavaScript and React course · Module 8: Advanced React Patterns
Introduction: When to Use HOC vs Custom Hooks
When is it worth using a Higher-Order Component (HOC) instead of a custom hook?
Answer options
- HOC is always faster than a custom hook
- When we want to add shared logic to many class components that don't support hooks
- Custom hooks cannot share logic between components
- HOC is the only way to lazy load components
You can check the correct answer by solving this task in the CodeWorlds game.