How to open a link in a new Tab in NextJS?

clock icon

asked 201 days agoAsked

message

2Answers

eye

92Views

How can i open a link in a new Tab in NextJS ? i tried this :

<Link href="https://twitter.com/" passHref>
        <a target="_blank">
          <div className={`${dark ? styles.iconTwitterWhite : styles.iconTwitter} mr-3`} />
        </a>
      </Link>

2 Answers

If youre using NextJs, You must utilize Next Link feature rather than using plain html <a> tag for creating link


import Link from 'next/link'

// then gamitin mo lang din parang a tas lagyan mo ng target

<Link target="_blank" href="href mo dito"> My Link Desu </Link>

 

Write your answer here

Top Questions