refactor: Use generic type for usePrevious hook
#7011
+4
−4
usePrevious hook
#7011