Skip to content
Discussion options

You must be logged in to vote

Hey! This discussion is quite old so I didn't see that it hasn't been answered yet. I will describe how it works.

How useDerivedValue works

In general, useDerivedValue callback is executed only if values, used within the callback, change. So, the callback is triggered if you use other Shared Values within it and modify at least one of them or if you use plain values and they change (like in the useEffect hook, but you don't have to specify the dependencies array as the hook is "smart" thanks to the reanimated babel plugin and automatically adds dependencies for you).

In short, useDerivedValue is triggered only if dependent values (either Shared Values or plain values) change.

Answering qu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MatiPl01
Comment options

Answer selected by MatiPl01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants