I have a question about useTracker
from meteor and react.
const sample = useTracker(
() => func1(),
[slug],
);
Does this mean every time sulg
gets changed, fun1
gets running and sample
will get a new value? like a dependency array with useEffect?
Thank you
You are partially right, if
slug updates
your function re-runs but it would also re-run if the functionfunc1
is using a reactive data source.The documentation for
useTracker
has a pretty good example:see: https://github.com/meteor/react-packages/tree/master/packages/react-meteor-data#usetrackerreactivefn-deps-hook-with-deps