useEffect
is a built-in React Hook that lets you run code after the component renders.
It’s commonly used for:
- Fetching data from APIs
- Setting up subscriptions
- Updating the DOM
- Cleaning up on unmount
🧠 Basic Example
tsx
import { useEffect } from 'react';
useEffect(() => {
console.log("Component mounted!");
}, []);
Top comments (0)