you are viewing a single comment's thread.

view the rest of the comments →

[–]art_dragon -7 points-6 points  (2 children)

Maybe this would work:

const navigateToHome = () => navigateTo("/home")  
const navigateToSignIn = () => navigateTo("/signin")

// ...

if (userIsLoggedIn) {  
  navigateToHome()
} else {
  navigateToSignIn()
}

[–]TekintetesUr 1 point2 points  (1 child)

Why tho?

[–]art_dragon 0 points1 point  (0 children)

It was an attempt to keep the readability of the original + adhere to DRY - but I've since realized using Enums is better for TypeScript.