Episode 22 game · Chitragupta · Water
Break the Ouroboros
Kai opens his scroll search once, and it fetches forever. Feel the useEffect infinite loop as Chitragupta’s ledger fills with renders, fix the dependency that is a new object on every render and the button that sets state while rendering, then prove the page makes exactly one request.
Not opened yet.
1 · Feel the loop
The board runs a small model of React: render, then the effect runs if any dependency changed by Object.is, then setResults with the new array. Open the page once.
2 · Cut the tail
Two snakes hide in Kai’s code. Fix the effect’s dependencies, then the button that sets state while rendering.
3 · The ledger audit
Your fixed code, through a mount, five parent re-renders and a tag change. Every count must match what the page needs, and nothing more.
New seal earned
The serpent let go of its tail
Acharya’s Rule #22Never set state while rendering. Give every effect dependencies that change only when they should.
{ tag } made in the body fails Object.is each time, so the effect runs again.
Build the object inside the effect and list [tag]; strings compare by value.
Write onClick={() => setOpen(true)}, not onClick={setOpen(true)}.