title: How to handle the navigation for the Button click in ReactJS?
body: <p>I am implementing a new app. Currently, I am able to do the navigation for the Link and couldn't do it for the button click navigation. I have checked <a href="https://stackoverflow.com/questions/40079797/reactjs-navigation/40080108">this post</a> and tried with BrowserHistory option. But this method is currently not supported.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import React, { Component } from "react";
  import {Route,Router,NavLink,HashRouter,BrowserRouter} from "react-router-dom";
  import Contact from "./components/Contact";
  import Home from "./components/Home";
  import EnquiryResult from "./components/EnquiryResult";
  import logo from './logo.svg';
  import './App.css';
  
  class MainStack extends Component {
  
    onClick(){
     // browserHistory.push("/EnquiryResult");
  }
  
    render() {
      return (
          &lt;div&gt;
          &lt;header className="App-header"&gt;
            &lt;img src={logo} className="App-logo" alt="logo" /&gt;
            &lt;h1 className="App-title"&gt;Welcome to React&lt;/h1&gt;
          &lt;/header&gt;
          &lt;div&gt;
            &lt;button className="btn" onClick={this.onClick.bind(this)}&gt;Enquiry&lt;/button &gt;
            &lt;/div&gt;
  
            &lt;ul className="header"&gt;
              &lt;li&gt;&lt;NavLink  to="/contact"&gt;Contact&lt;/NavLink &gt;&lt;/li&gt;
              &lt;li&gt;&lt;NavLink  to="/Home"&gt;Home&lt;/NavLink &gt;&lt;/li&gt;
            &lt;/ul&gt;
  
            &lt;div&gt;
              &lt;Route path="/Home" component={Home}/&gt;
              &lt;Route path="/contact" component={Contact}/&gt;
              &lt;Route path="/EnquiryResult" component={EnquiryResult}/&gt;
  
          &lt;/div&gt;
          &lt;/div&gt;
      );
    }
  }
  
  export default MainStack;
  </code></pre>
  
  <p>navigation is working fine for the contact and Home. But couldn't achieve the navigation for the Enquiry. How can I achieve this button navigation?</p>