Stop using anon functions in hooks