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!
Source: stackoverflow.com
Related Query
- Open link in new tab in react router programmatically
- React Router browserHistory.push open link in a new tab
- How can I open an external link in new tab in react native?
- React Router - Open Link on new Tab and Redirect to Home Page
- React Link to open new tab
- webview in react native when click on any link in website which open in new tab or new window its goes to browser not override on the webview
- React-Router open Link in new tab
- History.push a link to a new tab with react router
- React history.push allow user to open in new tab
- React: open link in a new tab
- React Router Link to New Tab
- open link in a new tab using Link Next.js component
- How to open some child links in new tab in React
- react js, when open page Other than home in new tab show 404
- React-Router open Link in new tab content is opening in same existing tab
- How to open a PDF download into a new tab when calling a GET function from React frontend?
- React Markdown links dont open in a new tab despite using target="_blank"
- react js How to open new page from child link on content without show previous page
- I want to open a new Tab in React application on button click?
- Open new tab with useNavigate hook in React
- Open link in new tab when ctrl + click it in ReactJS?
- React + React Router, handling all links to open in new tab
- Open New Tab When User Clicks on Link to External Website
- How to open react component in new tab without rendering the whole app component?
- Dockerized Create React App doesn't open a new tab
- How to open a new tab from a react front-end app
- Adding target=_blank to link tag in button in react does not open new page but disables it?
- How to open a page in new tab on click of a button in react? I want to send some data to that page also
- Open a component in new window on a click in react
- can't open new tab in react, adds localhost:3000 on link?
More Query from same tag
- How to make a floating label which can move up when focus or has content in React?
- Retrieve response errors with axioson 400 and 401 status code
- How to add component onclick on multiple times in react?
- How To Toggle object in array with React Hooks i want to toggle className ".card like" and "card dislike" with button className"card-button"
- Passing the value of a clicked element in a child component into a button in a parent component in react via state lifting not working
- React/Typescript multimap
- react testing library: can't acquire context from the given item
- ReactJS - prevState in the new useState React hook?
- Using React, NodeJS, and Postgres: Having trouble being able to delete and updating todos
- React router useHistory.push renders component but useState, useEffect not updating without refresh
- Changing functional component state from other functional component
- How to return JSON data in a list after retrieving it from a URL source?
- Fetch no-cors Unexpected end of input
- How to prop drill with type interfaces in my React Typescript counter?
- Can we put an edit text in react-moveable? (Drag and edit both)
- Converting a stateful component to stateless
- Manage duplicate subdocuments in mongoDB using mongoose
- How do you change what jsx blocks are being rendered from inside a same class?
- How to Use URL Parameters and Query Strings With React Router
- React router private route not rendering
- I deployed React and spring boot into 2 different applications on heroku. How can i make them talk to each other
- React native mapping through array with object childs - working different as in react web?
- How to trigger the useCallback in React
- Onclick with Button in Material-Table
- Trouble with Fetch in React with CORS
- Im trying to upload a file with express and fileupload, but I cant get it to work
- Chaining useEffects with early return
- Error thrown but not caught in useEffect try-catch?
- react-stripe-elements Error: You must provide a Stripe Element or a valid token type to create a Token
- How to add fontColor, fontBackgroundColor, fontSize to ckeditor5 in React