# Application using react-router-dom

Lets build this application with react-router-dom&#x20;

![](https://1949368877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LgMQu802me2gEI8E8bY%2F-LisebR5tRCbQ37JtQzc%2F-LiskxhNk6sAG57Wi7qx%2FScreen%20Shot%202019-07-03%20at%2010.08.28%20PM.png?alt=media\&token=ed54ad93-fded-42c6-b6f5-e542dda83bc0)

Our root container using hashRouter

```
import React from 'react';
import { render } from 'react-dom';
//------------------dashboard-------------------//
import MainComponent from './components/main';

import {HashRouter } from 'react-router-dom'
render(
		<HashRouter>
		   	<div className="container">
			      	<MainComponent />
				</div>
		</HashRouter>
, document.getElementById("app"));
```

Routing for Root components can be added in our main component, our main component will look like&#x20;

```
import { Route, NavLink } from 'react-router-dom';
const MainComponent = (props) => {
    return (<div>
        <nav className="row space-between">
            <ul className="row nav">
                <li><NavLink activeClassName="active" className="nav-link" to="/overview">Overview</NavLink></li>
                <li><NavLink activeClassName="active" className="nav-link" to="/battle" aria-current="page" href="/battle" >Battle</NavLink></li>
            </ul>
        </nav>
        <Route exact path="/" component={GithubOverviewPage} />
        <Route path="/overview" component={GithubOverviewPage} />
        <Route path="/battle" component={BattelPageComponent} />
        <Route exact path="/compare" component={GithubBattlePage} />
        </div>
        )
}

```

Nexted Routes where we are passing route param as technology name&#x20;

```
import React from "react";
import { Route, NavLink, Switch } from 'react-router-dom'
import OverviewTechnologyComponent from '../overview/pages/OverviewTechnologyComponent';

class OverviewPageComponent extends React.Component {

  render(){
  return (
    <div>
    <ul className="flex-center">
        <li><NavLink activeClassName="active" to="/overview/all" className="btn-clear nav-link"> All </NavLink>
        </li><li><NavLink activeClassName="active" to="/overview/js" className="btn-clear nav-link ">JavaScript</NavLink>
        </li><li><NavLink activeClassName="active" to="/overview/ruby" className="btn-clear nav-link ">Ruby</NavLink>
        </li><li><NavLink  activeClassName="active" to="/overview/java" className="btn-clear nav-link ">Java</NavLink>
        </li><li><NavLink activeClassName="active" to="/overview/css" className="btn-clear nav-link ">CSS</NavLink></li>
        <li><NavLink activeClassName="active"   to="/overview/python" className="btn-clear nav-link ">Python</NavLink></li>
      </ul>
      <Switch>
        <Route exact path="/" component={OverviewTechnologyComponent} />
        <Route path="/overview/:name" component={OverviewTechnologyComponent} />
      </Switch>
    </div>)
  }
}
export default OverviewPageComponent;

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tkssharma.gitbook.io/react-training/day-05/next-stop-react-router-or-spa/application-using-react-router-dom.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
