Screen crash: Maximum update depth exceeded
React NativeConfirmed fix
React 19
Error
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.Cause
Three separate effects each "corrected" the same value and overwrote each other, so every render triggered another setState.
Fix
Have one place decide the value, and only set state when it actually changes (if (next !== current) setX(next)).
More React Native errors
- Screen crashes the whole app: Rendered more hooks than during the previous renderRendered more hooks than during the previous render
- Feed shows an error state for every address: ReferenceError before initializationReferenceError: Cannot access 'scoreById' before initialization
- Reanimated crash on device: Tried to synchronously call a non-worklet function on the UI thread[Worklets] Tried to synchronously call a non-worklet function `clamp01` on the UI thread.
- Rows wrapped in <Link asChild> collapse to a tiny height
- Pressable buttons render invisible: style function fill never applied