fixed component not loading on reload and nested url

This commit is contained in:
Kim, Jimin 2021-05-30 17:59:03 +09:00
parent a4677b19c2
commit 8263a76e41
2 changed files with 2 additions and 2 deletions

View file

@ -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} />
)}

View file

@ -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"