9

I've just upgraded to "react-router": "^4.1.1" and now I'm getting 404's from all routes except the default route. Not sure what I'm missing here?

Any assistance is appreciated.

import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import {  BrowserRouter, Route, Switch } from 'react-router-dom'


import Tee from './components/Tee'
import About from './components/About'
import Home from './components/Home'

class App extends Component {
    render() {
        return (
            <BrowserRouter>
                <div>
                    <Switch>
                        <Route exact path="/" component={Home} />
                        <Route path="/about" component={About} />
                        <Route path="/tee" component={Tee} />
                    </Switch>
                </div>
            </BrowserRouter>
        );
    }
}

export default App;


ReactDOM.render((
    <App />
     ),
     document.getElementById('app')
);

1 Answer 1

2
+50

I have tested your code, and duplicated to my own project here:

https://github.com/tzookb/react-router-stackoverflow-q/tree/master

but everything seems to work perfectly, kudos for that! :)

So please can you update your question with relevant errors? please go through my repo and see that all is good.

2
  • Thats interesting. I get 404 errors from my routes with the exception of home.
    – Jimi
    Commented Jul 9, 2017 at 7:51
  • Great! Happy it helped Commented Jul 9, 2017 at 8:39

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.