score:3

Your HTML must be in your public folder, in my case terminos.html

  1. In your App.js, add this code:
    <Route exact path="/terminos" render={() => {window.location.href="terminos.html"}} />
  1. If you want to add an anchor, like <a/>, add this code:
     <a target="_blank" href={process.env.PUBLIC_URL + "terminos.html"} > terminos</a>

score:8

To statically link to a different page, simply use the standard HTML anchor tag:

<a href="normal_redirect.html">Redirect to Html page</a>

When the user clicks on the link, it's a normal page navigation to the href value of the tag.


To dynamically send the user to another page, use <Route> component's render property:

<Route exact path="/normal_redirect" render={() => {window.location.href="normal_redirect.html"}} />

Essentially, use the Route component's render property to tell the browser to navigate to a different page: https://reacttraining.com/react-router/web/api/Route


Try this:

class App extends Component {
  render() {
    return (
      <div>
        <a href="/Users/yashchoksi/Documents/route/src/normal_redirect.html">Press</a>
      </div>);
  }
}

Please notice how I've removed the Router, Route, Switch, and Link components from the code. For a normal link, you don't need any of them.


Related Query

More Query from same tag