What is React?
React is a JavaScript library created by Facebook for building user interfaces (UI), especially single‑page applications (SPAs).
It helps developers build reusable components instead of writing repetitive code.
Why React?
Reusable components → less code duplication.
Fast rendering → thanks to Virtual DOM.
Strong ecosystem → libraries like React Router, Redux.
Popular in industry → many companies use it for web apps.
What are Hooks?
Hooks are special functions in React that let you use state and other React features in functional components (without needing class components).
Introduced in React 16.8.
Common Hooks:
useState → manages state inside a component.
useEffect → handles side effects (API calls, timers, subscriptions).
useContext → shares data across components without props.
useRef → stores a mutable value or references DOM elements.
useReducer → manages complex state logic (like Redux but simpler).
Custom Hooks → you can create your own reusable logic starting with use.
Top comments (0)