0

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')
);

I get the following error :enter image description here

0

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.