Should I use useCallback hook on a function that only changes route

Viewed 63

I have following simple component:

I am using react-route-dom to handle routing in my app. My question is if I should use hook useCallback on my handleRedirect function?

export const SomeComponent = () => {
  const navigate = useNavigate();
  
  const handleRedirect = (route) => {
    navigate(route)
  }

  return (
    <>
      <button onClick={() => handleRedirect(route)}>Redirect</button>
    </>
  )

}

0 Answers
Related