Route Redirects To Nothing React-router 4
I'm not sure why everything is redirecting to a blank page: I'm using: 'react-router': '^4.2.0', 'react-router-dom': '^4.1.1', App.js import { BrowserRouter, Route, Switch } from
Solution 1:
All your paths needs to be with respect to to base path i.e. /
Change your router config to
<Switch><Routecomponent={HomePageContainer}exactpath="/" /><Routecomponent={CompanyDetailContainer}name="companydetail"path="/interviews/companies/:companyId/details" /><Routecomponent={InterviewContainer}name="interview"path="/interviews/companies/:companyId" /><Routecomponent={Container}path="/" /><Routecomponent={NotFound}path="*" /></Switch>
Solution 2:
Try wrapping your router in an anonymous function.
constApp = () => (
<BrowserRouteronUpdate={onUpdate}><Switch><Routecomponent={HomePageContainer}exactpath="/" /><Routecomponent={CompanyDetailContainer}name="companydetail"path="interviews/companies/:companyId/details" /><Routecomponent={InterviewContainer}name="interview"path="interviews/companies/:companyId" /><Routecomponent={Container}path="/" /><Routecomponent={NotFound}path="*" /></Switch></BrowserRouter>
)
Post a Comment for "Route Redirects To Nothing React-router 4"