reactjshrefonclicklistenerlocation-href

How to make the href link to open in the new right hand-side direction tab in React.js


The href is not opening in the new tab/windows at the right hand-side tab, however is opening at the left hand-side tab

import resume from "../files/resume.pdf"

        {/* Links to the Contact me  */}
         <a href="#contactme" onClick={handleClick("contactme")}> 
           Contact Me 
         </a>

         <a href={resume} onClick={()=> window.open("_blank", "resume")}> 
           Resume 
         </a> 
       </HStack> 

Expecting the resume to be opened to the new tab at the right direction, am i doing something wrong?


Solution

  • use the below code snippet

    <a href='../files/resume.pdf' target='_blank'> 
       Resume 
    </a> 
    

    instead of

    <a href={resume} onClick={()=> window.open("_blank", "resume")}> 
       Resume 
    </a>