All skills
Skillintermediate
react compiler reanimated shared values
With React Compiler enabled, use `.get()` and `.set()` instead of reading or writing `.value` directly on Reanimated shared values. The compiler can't track property access—explicit methods ensure correct behavior.
Claude Code Knowledge Pack7/10/2026
Overview
Use .get() and .set() for Shared Values with React Compiler
With React Compiler enabled, use .get() and .set() instead of reading or
writing .value directly on Reanimated shared values. The compiler can't track
property access—explicit methods ensure correct behavior.
Incorrect (breaks with React Compiler):
function Counter() {
const count = useSharedValue(0)
const increment = () => {
count.value = count.value + 1 // opts out of react compiler
}
return
}
Correct (React Compiler compatible):
function Counter() {
const count = useSharedValue(0)
const increment = () => {
count.set(count.get() + 1)
}
return
}
See the Reanimated docs for more.