I have been trying to follow the docs in using react-router's Router, Route, and Switch components.
But I have been completely unable to get URL parameters working. I can get all other routes working, but anything that involves /:variable, I just cannot seem to get working.
From their docs, they have this code:
import { Switch, Route } from 'react-router'
<Switch>
<Route exact path="/" component={Home}/>
<Route path="/about" component={About}/>
<Route path="/:user" component={User}/>
<Route component={NoMatch}/>
</Switch>
And I have this:
const AppRouter = () => {
return (
<Router>
<div>
<Header />
<Switch>
<Route exact path="/" component={HomePage} />
<Route path="/pricing" component={PricingPage} />
<Route path="/contact" component={ContactPage} />
<Route path="/signup" component={SignupPage} />
<Route path="/login" component={LoginPage} />
<Route path="/forgotpassword" component={ForgotPasswordPage} />
<Route path="/resetpassword/:token" component={ResetPasswordPage} />
<PrivateRoute path="/dashboard" component={DashboardPage} />
</Switch>
</div>
</Router>
);
};
Every single component/route works except for /resetpassword/:token and I cannot for the life of me figure out why.
When I go to http://localhost:8000/resetpassword it actually shows me my header component.
When I go to http://localhost:8000/resetpassword/ or http://localhost:8000/resetpassword/123, I get these errors in the console:
GET http://localhost:8000/resetpassword/dist/style.css net::ERR_ABORTED
GET http://localhost:8000/resetpassword/dist/bundle.js 404 (Not Found)
Can anyone spot my mistake?
Here is a link to this file in my current repo if that would help.
Thanks
http://localhost:8000/resetpassword/123for example.