React reuses each row's internal state for whatever item now lands on that key, so the wrong row ends up with the wrong checkbox.
Fix: key by a stable https://t.co/NJt4OxNOYk instead of position, assigned once at creation, and add react/no-array-index-key to catch before it ships
key={index} ties React's identity tracking to position, not the item itself. Delete a row and everything below it shifts up one index.
#react#javascript
https://t.co/WfvxM3bPmv
Every later call to goToScreen() uses that same frozen-at-import value, silently doing nothing.
Fix: fetch the navigator fresh inside the function instead of at import time, or use a stable ref from createNavigationContainerRef(), whose isReady() guards against calling too early.
getNavigator() runs the instant this file is imported — before NavigationContainer has mounted — so the captured navigator is null, forever.
#react#typescript#javascript#cleancode#fyp
https://t.co/v2NblaHe2Z
The loop keeps calling setState on a screen that's not there, still running, until the app is closed.
Track the current frameId and cancel it in the effect's cleanup, then add a cancelled flag checked inside the loop itself so a frame already in flight can't sneak one more update
P110: requestAnimationFrame reschedules itself every single frame, and nothing ever calls cancelAnimationFrame when the component unmounts.
#react#javascript
https://t.co/mlkR77QXCa
Keep a stack of days still waiting for a warmer one. The moment today beats the stack's top, pop it and record the gap. Each day gets pushed and popped exactly once. O(n) instead.
Finding how many days until a warmer temperature by scanning forward from every day means, worst case, every day rescans the rest — O(n²).
#DSA#Leetcode
https://t.co/aBIpU30PcN
https://t.co/8KKphJjeey
Chain sees a resolved value instead of a rejection, and .catch() never fires for exact case it was written to catch.
Fix: return the rejected promise so it propagates properly, or switch to async/await, where throw always propagates and there's no "forgot the return" version.
P108: Promise.reject() creates a rejected promise, but nothing returns it — so the .then() callback falls through and implicitly returns undefined.
#react#javascript
https://t.co/Qzi2kRrx3b
A plain stack has to scan every element to find the minimum, every single call. Keep a second stack alongside the first, pushing the running minimum with every value pushed. getMin becomes a peek instead of a scan. O(n) becomes O(1)
The transition drops frames because the thread is busy elsewhere.
Fix: wrap the work in InteractionManager.runAfterInteractions so it waits until the animation settles, then cancel the returned task on unmount so it can't fire after the user has left.
🔖 save slide 5.
P106: The transition animation and a heavy analytics call start at the exact same instant on mount — both fighting for the same JS thread while a screen is trying to animate in.
#javascript#react
https://t.co/5M463l9ULW