trying alt router

This commit is contained in:
Orion Reed 2023-08-12 18:50:34 +01:00
parent 834a2dd72b
commit 792874b3fc
3 changed files with 18 additions and 14 deletions

9
package-lock.json generated
View File

@ -16,6 +16,7 @@
"minisearch": "^6.1.0",
"preact": "^10.13.1",
"preact-iso": "^2.3.1",
"preact-router": "^4.1.2",
"reading-time-estimator": "^1.9.0"
},
"devDependencies": {
@ -5996,6 +5997,14 @@
"preact": ">=10"
}
},
"node_modules/preact-router": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/preact-router/-/preact-router-4.1.2.tgz",
"integrity": "sha512-uICUaUFYh+XQ+6vZtQn1q+X6rSqwq+zorWOCLWPF5FAsQh3EJ+RsDQ9Ee+fjk545YWQHfUxhrBAaemfxEnMOUg==",
"peerDependencies": {
"preact": ">=10"
}
},
"node_modules/pretty-format": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",

View File

@ -18,7 +18,7 @@
"jsonlines": "^0.1.1",
"minisearch": "^6.1.0",
"preact": "^10.13.1",
"preact-iso": "^2.3.1",
"preact-router": "^4.1.2",
"reading-time-estimator": "^1.9.0"
},
"devDependencies": {

View File

@ -1,6 +1,6 @@
import 'preact/debug'
import { render } from 'preact'
import { LocationProvider, Router, Route } from 'preact-iso'
import Router from 'preact-router'
import { Home } from '@/pages/Home'
import { Posts } from '@/pages/Posts'
import Post from '@/pages/Post'
@ -14,18 +14,13 @@ export function App() {
return (
<MantineProvider withGlobalStyles withNormalizeCSS theme={theme}>
<Box mb="xl">
<LocationProvider>
<Router>
<Route path="/" component={Home} />
<Route path="/posts" component={Posts} />
<Route path="/posts/" component={Posts} />
<Route path="/posts/:title" component={Post} />
<Route path="/posts/:title/" component={Post} />
<Route path="/stream" component={Stream} />
<Route path="/stream/" component={Stream} />
<Route default component={NotFound} />
</Router>
</LocationProvider>
<Router>
<Home path="/" />
<Posts path="/posts" />
<Post path="/posts/:title" />
<Stream path="/stream" />
<NotFound default />
</Router>
</Box>
</MantineProvider>
)