Storing non-state variables in functional components
The useRef hook is not just for DOM refs, but can store any mutable value you like. Example function FunctionalBar(props) { const [foo] = useState(new Animated.Value(0)); const _foo = useRef(0); function showFoo() { let anim = Animated.timing(foo, { toValue: 1, duration: 1000, useNativeDriver: true }); anim.start(() => console.log(_foo.current)); } useEffect(() => { function _onChangeFoo({ value … Read more