Answers for "open link in new tab react router"

4

open a new tab when clicking on a link react

<td onClick={()=> window.open("someLink", "_blank")}>text</td>
Posted by: Guest on August-13-2020
1

how to open a new tab in react

//More Secure Solution. For JS only.

const openInNewTab = (url) => {
  const newWindow = window.open(url, '_blank', 'noopener,noreferrer')
  if (newWindow) newWindow.opener = null
}

//Then add to your onClick
onClick={() => openInNewTab('https://stackoverflow.com')}
Posted by: Guest on February-25-2021
0

opening a link in another tab in react

import React from "react";

function App() {
  const handleClick = () => {
    window.open("http://twitter.com/saigowthamr");
  };

  return (
    <div>
      <h2>App</h2>
      <button onClick={handleClick}>Twitter</button>
    </div>
  );
}

export default App;
Posted by: Guest on October-27-2021
0

open in a new tab react

<td onClick={()=> window.open("someLink", "_blank")}>text</td>
Posted by: Guest on February-22-2021

Code answers related to "open link in new tab react router"

Code answers related to "Javascript"

Browse Popular Code Answers by Language