Question Bank · Section 05
React Lifecycle & Hooks
13 questions. Component lifecycle phases, class lifecycle methods and their hook equivalents, core hooks, effect cleanup, useLayoutEffect, and avoiding infinite loops and memory leaks.
Lifecycle and hooks questions test whether you understand when your code runs, not just what it does. Expect to map class methods to hooks, explain effect timing and cleanup, and debug classic bugs like infinite effect loops, stale closures and leaked subscriptions.
01Explain the React component lifecycle02What is the cleanup function in useEffect?03Mounting vs Updating vs Unmounting04When will the render method fire?05Scenario-based questions from React lifecycle06React latest features07React Hooks (useState, useEffect, useReducer, useContext)08What is useLayoutEffect and why do we need it?09How do you prevent an infinite loop in useEffect?10How do you stop memory leaks in React?11How do you cancel an API request when a component unmounts?12What are custom hooks and how do you build one?13What is useId and when should you use it?