> For the complete documentation index, see [llms.txt](https://tkssharma.gitbook.io/react-training/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tkssharma.gitbook.io/react-training/day-05/next-stop-react-router-or-spa/application-using-react-router-dom.md).

# Application using react-router-dom

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

![](/files/-LiskxhNk6sAG57Wi7qx)

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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` 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>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
