As rotas aninhadas do React-router-dom v4 não estão funcionando
Em referência à questão não resolvida (como conclusão final)
Várias rotas aninhadas no react-router-dom v4Como aninhar rotas no React Router v4?Também estou recebendo o mesmo problema.
https://reacttraining.com/react-router/web/guides/quick-start promovereact-router-dom
Além disso, as pessoas acham melhorlist down routes
em um arquivo em vez de componentes.
Algo referido: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config
Algo funcionando (principalmente):
import * as React from 'react'
import {BrowserRouter as Router, Route, Switch } from 'react-router-dom'
export const Routes = () => (
<Router>
<div>
<Switch>
<Route exact path="/login" component={Login}/>
<MainApp path="/">
<Route path="/list" component={List}/>
<Route path="/settings" component={Settings}/>
</MainApp>
<Route path="*" component={PageNotFound}/>
</Switch>
</div>
</Router>
)
Algo não está funcionando: site.com/SomeGarbagePath
mostra o<MainApp>
Eu acho que.<Route path="*" component={PageNotFound}/>
Atualizar
/ - Home - parent of all (almost)
/List - inside home
/Settings - inside home
/Login - standalone
/Users - inside home, For now just showing itself. It has further pages.
/User/123 - inside user with /:id
/User/staticUser - inside user with static route
/garbage - not a route defined (not working as expected)