Let's create a simple route that renders a simple component. First, you have a small React component that you want to render when the route is activated:
import React from 'react';
export default () => <p>Hello Route!</p>;
Next, let's look at the route definition:
import React from 'react';
import { render } from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import MyComponent from './MyComponent';
// The "<Router>" is the root element of the app.
render(
<Router>
<Route exact path="/" component={MyComponent} />
</Router>,
document.getElementById('root')
);
The Router component is the top-level component of the application. Let's break it down to know what's happening within the router.
You have the actual routes declared as <Route> elements. There are two key properties of any route: path and component. When the path is matched against the active URL, the component is rendered. But where is it rendered, exactly? The Router component doesn't actually render anything itself; it's responsible for managing how other components are rendered based on the current URL. Sure enough, when you look at this example in a browser, <MyComponent> is rendered as expected:

When the path property matches the current URL, the <Route> is replaced by the component property value. In this example, the route is replaced with <MyComponent>. If a given route doesn't match, nothing is rendered.