useEffect when all dependencies have changed?
问题 Current useEffect is fired when just one of the dependencies have changed. How could I update it / use it to fire back when both ( or all ) of the dependencies have changed? 回答1: You'll need to add some logic to call your effect when all dependencies have changed. Here's useEffectAllDepsChange that should achieve your desired behavior. The strategy here is to compare the previous deps with the current. If they aren't all different, we keep the previous deps in a ref an don't update it until