title: React Routing With Asp.net MVC
body: <p>I just started learning React and I`m having difficulties implementing BrowserRouter from React to navigate between pages in Asp.net MVC. </p>
  
  <p>I`ve used the same structure without applying react to asp.net MVC and it is working fine. </p>
  
  <p>It doesnt produce any error, it just doesnt have any changes in the page and even in the network activity when i click on the Link. </p>
  
  <p>My code applied with MVC is as follows:</p>
  
  <p>--index.js--</p>
  
  <pre><code>import BodyStructure from './App';
  import { BrowserRouter } from 'react-router-dom';
  
  
  ReactDOM.render(
  &lt;BrowserRouter&gt;
      &lt;BodyStructure /&gt;
  &lt;/BrowserRouter&gt;, document.getElementById('root'));
  </code></pre>
  
  <p>--App.js--</p>
  
  <pre><code>import NavigationBar from './Navigation/nav.app';
  import RoutingComponent from '../routingComponent';
  
  class BodyStructure extends React.Component {
  
  render() {
      return (
          &lt;div&gt;
              &lt;div id="NavigationBar"&gt;
                  &lt;NavigationBar/&gt;
              &lt;/div&gt;
              &lt;div id="MainContent"&gt;
                  &lt;RoutingComponent/&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      );
  }
  }
  
  export default BodyStructure;
  </code></pre>
  
  <p>--Nav.app.js--</p>
  
  <pre><code>import { Link } from 'react-router-dom';
  
  class NavigationBar extends React.Component {
  render() {
      return (
          &lt;div className="navbar navbar-inverse navbar-fixed-top"&gt;
              &lt;div className="container"&gt;
                  &lt;div className="navbar-header"&gt;
                      &lt;button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
                          &lt;span className="icon-bar"&gt;&lt;/span&gt;
                          &lt;span className="icon-bar"&gt;&lt;/span&gt;
                          &lt;span className="icon-bar"&gt;&lt;/span&gt;
                      &lt;/button&gt;
  
                  &lt;/div&gt;
                  &lt;div className="navbar-collapse collapse"&gt;
                      &lt;ul className="nav navbar-nav"&gt;
                          &lt;li&gt;&lt;Link to="/home"&gt;Home&lt;/Link&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;Link to="/about"&gt;About&lt;/Link&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      )
  }
  }
  
  export default NavigationBar
  </code></pre>
  
  <p>--routingComponent.js--</p>
  
  <pre><code>import { Switch, Route } from 'react-router-dom';
  import HomeStructure from './src/Home/home.app';
  import AboutStructure from './src/About/about.app';
  
  const RoutingComponent = () =&gt;
  (
      &lt;Switch&gt;
          &lt;Route path="/" component={HomeStructure}/&gt;
          &lt;Route path="/home" component={HomeStructure} /&gt;
          &lt;Route path="/about" component={AboutStructure}/&gt;
      &lt;/Switch&gt;
  )
  
  export default RoutingComponent;
  </code></pre>
  
  <p>Inside routingComponent.js line</p>
  
  <pre><code>&lt;Route path="/" component={HomeStructure}/&gt;, 
  </code></pre>
  
  <p>if i change component to AboutStructure the program understands it and change the maincontent id to AboutStructure. But when the url changes, it doesnt switch to the required component based on the url.</p>
  
  <p>Tqvm in advanced for your help. I tried searching for link relating asp.net MVC with React but didnt manage to find a lot. </p>