Hack Frontend Community

React Lifecycle: Complex Effect Chain

Hard

Determine the call order in a complex effect chain with state changes. Question: What will be the complete order of console.log calls from mount to completion? Hints: • Effect can call setState, triggering re-render • On re-render, cleanup functions run first • Component may render multiple times in succession • Effects with different dependencies fire differently Acceptance Criteria: ✓ Correct order of ALL console.log calls ✓ Explanation of how many renders occur ✓ Explanation of which effects fire on each render ✓ Understanding of complex effect chains