Skip to content

Instantly share code, notes, and snippets.

@mattgperry
Last active March 30, 2020 12:41
Show Gist options
  • Save mattgperry/1d2679bd926ef65bc94f44b08a626cad to your computer and use it in GitHub Desktop.
Save mattgperry/1d2679bd926ef65bc94f44b08a626cad to your computer and use it in GitHub Desktop.
const Component = () => {
const frameCount = useRef(0)
const prevValues = useRef()
return <motion.div transformValues={values => {
frameCount.current++
const valuesToReturn = isEven(frameCount.current) ? prevValues.current : values
prevValues.current = values
return valuesToReturn
}} />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment