tezvyn:

Reanimated Worklets: Run JS on the UI Thread

Source: docs.swmansion.comintermediate

A Reanimated worklet is a JS function that runs directly on the UI thread, bypassing the bridge for 60fps animations. They're used in hooks like `useAnimatedStyle` to compute styles without dropping frames. The footgun: worklets capture their entire closure.

A Reanimated worklet is a JavaScript function that runs directly on the UI thread, bypassing the React Native bridge for smooth, 60fps animations. Reanimated hooks like `useAnimatedStyle` and Gesture Handler callbacks automatically create worklets to compute styles or react to gestures without dropping frames. The main footgun is accidental closure capture: referencing one property from a large object (`theme.color`) will serialize and copy the entire `theme` object to the UI thread, causing performance hits.

Read the original → docs.swmansion.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Reanimated Worklets: Run JS on the UI Thread · Tezvyn