Save this html page on your disk with the name ExampleLinkReact.html,
and open it with your browser, say chromium 115.
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>ExampleLinkReact</title>
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src='https://unpkg.com/react-router-dom@5.0.0/umd/react-router-dom.min.js'></script>
<script src='https://unpkg.com/babel-standalone@6.26.0/babel.js'></script>
</head>
<body>
<div id='root'></div>
<script type='text/babel'>
const Link = ReactRouterDOM.Link;
const Route = ReactRouterDOM.Route;
const ExampleLinkReact = () => (
<div style={removeallstyles}> {/*1*/}
<div style={container100postlist}>
<p style={style_label}> ExampleLinkReact </p>
<div style={hspace3}> </div>
<p> Open every link in new tab</p>
<div style={block1}>
<ReactRouterDOM.HashRouter>
<ul style={ulist_style}>
<li><Link to="/InnerComponent">InnerComponent</Link></li>
<li><Link to='/LocalHTMLPage'>LocalHTMLPage</Link></li>
<li><Link to='/LinkExternalUrl'>LinkExternalUrl</Link></li>
</ul>
<Route path="/InnerComponent" exact component={InnerComponent} />
<Route exact path="/LocalHTMLPage" render={() => {window.location.href="LocalHTMLPage.html"}} />
<Route exact path="/LinkExternalUrl" render={() => {window.location.href="https://example.com/1234"}} />
</ReactRouterDOM.HashRouter>
<div style={hspace3}> </div>
</div> {/*block1 end*/}
{/*/////////////////////////////////////////////////////////////////////////////////////*/}
{/*/////////////////////////////////////////////////////////////////////////////////////*/}
</div> {/*container100postlist*/}
</div> /*removeallstyles*/
)
//define InnerComponent
const InnerComponent = () => <h1>InnerComponent</h1>
///////////////////////////////////////////////////////////////////////////////////
{/*CSS CODE START. */}
//This is only elementary css, you can ignore it;
const removeallstyles = { all: 'revert',}
const hspace3={height: 0.05*window.innerHeight, backgroundColor: 'transparent', position: 'relative'};
const vhspace1={width: 0.05*window.innerWidth, backgroundColor: 'transparent', position: 'inline-block'};
//container100postlist
const container100postlist_width =94;
const container100postlist_border=1;
const container100postlist =
{
//margin:'0 auto',
//textAlign: 'center',
position: 'absolute',
width: container100postlist_width+'vw',
backgroundColor:'transparent',
display: 'block',
clear: 'both',
};
const style_label =
{
backgroundColor:'transparent',
marginTop: '1vh',
marginBottom: '1vh',
textAlign: 'left',
display: 'block',
clear: 'both',
position: 'relative',
fontWeight: 'bold',
};
var block1 =
{
textAlign: 'left',
float: 'left',
display: 'block',
clear: 'both',
padding: '0.5vw',
//height: '40%',
width: '97vw',
//backgroundColor:'red',
border: '0.1vh solid red',
};
const ulist_style =
{
//listStyle: 'none',
listStylePosition: 'inside',
paddingLeft: '1vw',
}
{/*CSS CODE END. */}
///////////////////////////////////////////////////////////////////////////////////
ReactDOM.render(<ExampleLinkReact />, document.querySelector('#root'));
</script>
</body>
</html>