score:0

there is a simple way you can do that without react-router library,

make a link component like blow and use it.

const link = () => {
    const linkref = useref(null)
    const handleclick = () => {
         linkref.current.link.click()
    }
    return (
       <div ref={linkref} onclick={handleclick}> 
          <a href="http://google.com" target="_blank">go to google!</a>
       </div>
    )
}

you can put the link you want in href and render the link component where you want! also you can give it a style you want cuz it's a component! :d

i hope you find an answer!


Related Query

More Query from same tag