ReactQuestion 07 of 28
Why do we need hooks in ReactJS?
Answer out loud or in your head first, then compare.
Answer
Hooks let function components use:
- state,
- effects,
- context,
- refs,
- reusable logic.
Before hooks, many of these needed class components.
Custom hooks also let you extract logic without HOCs and render props.
How did it go? Be honest — “Not yet” puts the question on your review list.
Related questions
- C-P03 · What are hooks, and why don't we call them conditionally? — React, Next.js and frontend