learn.aathan.in ← back to aathan.in

React Hooks Cheatsheet

Quick reference for the hooks I reach for most.

useState

const [count, setCount] = useState(0);

Triggers a re-render whenever setCount is called with a new value.

useEffect

useEffect(() => {
  const id = setInterval(tick, 1000);
  return () => clearInterval(id);
}, []);

The returned function is the cleanup — runs before the next effect and on unmount.