react open url in new tab ReactJS – Router

Today, We want to share with you react open url in new tab ReactJS – Router.In this post we will show you react open new tab on button click, hear for react open link in new tab programmatically we will give you demo and example for implement.In this post, we will learn about How to Open URL in New Tab using ReactJS with an example.

react open url in new tab ReactJS – Router

There are the Following The simple About react open new tab programmatically Full Information With Example and source code.

As I will cover this Post with live Working example to develop React-Router open Link in new tab, so the react router open in new tab is used for this example is following below.

ReactJS – Router

Phase 1 – Install a React Router

npm install react-router

Phase 2 – Create Components

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

main.js

import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Link, browserHistory, IndexRoute } from 'react-router'

class App extends React.Component {
   render() {
      return (
         <div>
            <ul>
            <li>Laravel</li>
            <li>Social</li>
            <li>EarnMoney</li>
            </ul>
            {this.props.children}
         </div>
      )
   }
}
export default App;

class Laravel extends React.Component {
   render() {
      return (
         <div>
            <h1>Laravel...</h1>
         </div>
      )
   }
}
export default Laravel;

class Social extends React.Component {
   render() {
      return (
         <div>
            <h1>Social...</h1>
         </div>
      )
   }
}
export default Social;

class EarnMoney extends React.Component {
   render() {
      return (
         <div>
            <h1>EarnMoney...</h1>
         </div>
      )
   }
}
export default EarnMoney;

Phase 3 – Add a Router

main.js

ReactDOM.render((
   <Router history = {browserHistory}>
      <Route path = "/" component = {App}>
         <IndexRoute component = {Laravel} />
         <Route path = "laravel" component = {Laravel} />
         <Route path = "social" component = {Social} />
         <Route path = "earnmoney" component = {EarnMoney} />
      </Route>
   </Router>
), document.getElementById('app'))

Web Programming Tutorials Example with Demo

Read :

Another must read:  How to Open URL in New Tab using ReactJS

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about javascript open link in new tab.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

Your email address will not be published. Required fields are marked *