Adapting to changes in the solid router API
This commit is contained in:
parent
695955d049
commit
753aa71f4a
2 changed files with 12 additions and 15 deletions
|
@ -1,18 +1,22 @@
|
||||||
import { Route, Routes } from "@solidjs/router";
|
import { Route, Router } from "@solidjs/router";
|
||||||
import { JSXElement } from "solid-js";
|
import { JSXElement } from "solid-js";
|
||||||
|
|
||||||
import { NewPostInputArea } from "../Components/NewPost";
|
import { NewPostInputArea } from "../Components/NewPost";
|
||||||
import { Posts } from "../Components/Posts";
|
import { Posts } from "../Components/Posts";
|
||||||
import { SinglePost } from "../Components/SinglePost";
|
import { SinglePost } from "../Components/SinglePost";
|
||||||
|
|
||||||
|
function NotFound(): JSXElement {
|
||||||
|
return <h1>404</h1>;
|
||||||
|
}
|
||||||
|
|
||||||
// Primary is the section of the page that holds the main content
|
// Primary is the section of the page that holds the main content
|
||||||
export function Primary(): JSXElement {
|
export function Primary(): JSXElement {
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<Router>
|
||||||
<Route path="/" element={<Posts />} />
|
<Route path="/" component={Posts} />
|
||||||
<Route path="/post/:postid" element={<SinglePost />} />
|
<Route path="/post/:postid" component={SinglePost} />
|
||||||
<Route path="/new" element={<NewPostInputArea />} />
|
<Route path="/new" component={NewPostInputArea} />
|
||||||
<Route path="*" element={<h1>404</h1>} />
|
<Route path="*" component={NotFound} />
|
||||||
</Routes>
|
</Router>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,4 @@ import "./index.css";
|
||||||
|
|
||||||
const root = document.getElementById("root");
|
const root = document.getElementById("root");
|
||||||
|
|
||||||
render(
|
render(() => <Router root={Root} />, root!);
|
||||||
() => (
|
|
||||||
<Router>
|
|
||||||
<Root />
|
|
||||||
</Router>
|
|
||||||
),
|
|
||||||
root!
|
|
||||||
);
|
|
||||||
|
|
Loading…
Reference in a new issue