Reputation: 740
I have following implementation of "react-router-dom", but I am not able to get it working. can someone guide me what's the underlying issue.
App.jsx
import React from "react";
import Main from "../components/Main";
import Home from "../components/Home";
import { BrowserRouter, Match, Miss, Link } from 'react-router-dom';
const App = () => (
<BrowserRouter>
<div>
<Match exactly pattern="/" component={Main} />
<Match pattern="/home" component={Home} />
</div>
</BrowserRouter>
);
export default App;
Index.jsx
import React from "react";
import ReactDOM from "react-dom";
import Main from "./components/Main";
import Home from "./components/Home";
import Page from './components/Page';
import App from "./config/App";
ReactDOM.render(
<App/>,
document.getElementById('app')
);
Upvotes: 0
Views: 429
Reputation: 41
First of all, you should use Route instead of match.
Second, imports are case sensitive.
Third, match as per the doc you will get match object as prop.
Upvotes: 1
Reputation: 3310
Please refer to the docs of React Router v4
Match
and Miss
are from previous versions of react-router-v4.alpha
With the current stable release of v4. You should use Route
instead of Match
. Miss
is not there anymore.
I think this should solve your problem.
Upvotes: 2