Hooks are special functions that let you “hook into” React’s features.
They were introduced in React 16.8 to give functional components state and lifecycle capabilities (previously available only in class components).
State is data that changes over time — and when it changes, the UI updates automatically.
const [stateValue, setStateValue] = useState(initialValue);
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div style={{ textAlign: "center" }}>
<h2>Count: {count}</h2>
<button onClick={() => setCount(count + 1)}>➕ Increase</button>
<button onClick={() => setCount(count - 1)}>➖ Decrease</button>
<button onClick={() => setCount(0)}>🔁 Reset</button>
</div>
);
}
✅ Key Notes: