fixed component not loading on reload and nested url
This commit is contained in:
parent
a4677b19c2
commit
8263a76e41
2 changed files with 2 additions and 2 deletions
|
@ -226,7 +226,7 @@ export default class App extends React.Component<AppProps, AppState> {
|
|||
<NotFound />
|
||||
</Route>
|
||||
|
||||
<Route exact path="/:path">
|
||||
<Route exact path="/:path*">
|
||||
{({ match }) => (
|
||||
<Page key={match.params.path} />
|
||||
)}
|
||||
|
|
|
@ -13,7 +13,7 @@ export default class Page extends React.Component {
|
|||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
const fetched = pages[location.pathname]
|
||||
const fetched = pages[location.pathname.replace(/\/$/, "")] // remove a trailing slash
|
||||
if (!fetched) return
|
||||
|
||||
fetched.content = fetched?.content ? fetched.content : "No content"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue