I am working on an application where are lots of simple animations, 80% of them are just opacity changes based on boolean value, consider for example opacity of a button change from 40% to 100% on value change. So, to keep the opacity animation same over all application, let’s follow the DRY and SRP principle and extract that to custom hook so the only thing that the client of this hook really cares about is providing the boolean flag and optionally true/false opacity values if you want to use different opacity values on other places.