Skip to content

Commit

Permalink
native: conditional href via #
Browse files Browse the repository at this point in the history
  • Loading branch information
nandorojo committed Dec 13, 2022
1 parent c3cff46 commit ff1497c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/link/use-custom-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export function useLink({
}

if (shouldHandle) {
if (href === '#') {
// this is a way on web to stay on the same page
// useful for conditional hrefs
return
}
if (replace) {
router.replace(href, as, { shallow, scroll, experimental })
} else {
Expand Down

2 comments on commit ff1497c

@vercel
Copy link

@vercel vercel bot commented on ff1497c Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

solito-s9oj – ./example-monorepos/with-tailwind/apps/next

solito-s9oj.vercel.app
solito-s9oj-beat-gig.vercel.app
solito-s9oj-git-master-beat-gig.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ff1497c Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

with-custom-fonts – ./example-monorepos/with-custom-font/apps/next

custom-font.example.solito.dev
with-custom-fonts-fernandorojo.vercel.app
with-custom-fonts-git-master-fernandorojo.vercel.app
with-custom-fonts.vercel.app

Please sign in to comment.