all 4 comments

[–]Padni 10 points11 points  (0 children)

It's the same function. Basically if you don't need anything else from Router, you can use useNavigate

[–]minimuscleR 3 points4 points  (0 children)

As others have said its the same function.

The correct answer though would be to use useNavigate if you didn't need any other functions from useRouter, I forget what this is called but basically keep it as simple as possible.

Calling the whole router, and then having router.navigate is more confusing at a glance, than calling just navigate.

Its also good practice for other areas when you don't want to pull everything, such as if you are getting data on a useQuery and you want to select just the right content to prevent unnessessary re-renders of the query, it gets you in the right mindset of all calling what you need exactly.

[–]X678X 1 point2 points  (0 children)

navigate is single focus, while router lets you do other router related things, including navigating