Hooks in react
Hooks are functions that let you use state and other React features in function components. useState lets you add state, useEffect handles side effects, useContext accesses context, and custom hooks let you extract and reuse logic across components.
Example
import { useState, useEffect } from 'react';
function Counter() {
const [count, setCount] = useState(0);
useEffect(() => {
document.title = `Count: ${count}`;
}, [count]);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}useState manages the counter state, while useEffect synchronizes the document title with the count value.