Which hook runs after every render in React?
Correct answer
B. useEffect
12 views
B. useEffect
12 views
useEffect runs after React has rendered the component and the browser has painted. With no dependency array it runs after every render; with [] it runs once on mount; with dependencies it runs when they change.
useLayoutEffect fires earlier, before paint, while useState and useMemo manage state and cached values.
For more solved questions like this one, see Computer Science MCQs on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.