📖
Theory
Understand the concept step by step
useEffect is a React Hook used for side effects.
Examples of side effects include:
• Fetching data
• Updating the document title
• Timers
• Subscriptions
The dependency array controls when the effect runs.
💻
Example
See how the concept works in real code
React
import { useEffect } from "react";
function App() {
useEffect(() => {
console.log("Component loaded");
}, []);
return <h1>React App</h1>;
}
export default App;📤
Output
Understand what the code produces
Component loaded
📝
Practice
Test your understanding
Use useEffect to change the browser document title.
❓
MCQs
Check your knowledge
Which library is used for building this course's UI?
A.React
B.Django
C.Laravel
D.Spring
💼
Interview Questions
Prepare for React interviews
1.What is useEffect?
Think about the definition, purpose and practical use of this React concept.
2.When does useEffect run?
Think about the definition, purpose and practical use of this React concept.
3.What is the dependency array?
Think about the definition, purpose and practical use of this React concept.