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 { NewPostInputArea } from "../Components/NewPost";
|
||||
import { Posts } from "../Components/Posts";
|
||||
import { SinglePost } from "../Components/SinglePost";
|
||||
|
||||
function NotFound(): JSXElement {
|
||||
return <h1>404</h1>;
|
||||
}
|
||||
|
||||
// Primary is the section of the page that holds the main content
|
||||
export function Primary(): JSXElement {
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="/" element={<Posts />} />
|
||||
<Route path="/post/:postid" element={<SinglePost />} />
|
||||
<Route path="/new" element={<NewPostInputArea />} />
|
||||
<Route path="*" element={<h1>404</h1>} />
|
||||
</Routes>
|
||||
<Router>
|
||||
<Route path="/" component={Posts} />
|
||||
<Route path="/post/:postid" component={SinglePost} />
|
||||
<Route path="/new" component={NewPostInputArea} />
|
||||
<Route path="*" component={NotFound} />
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,4 @@ import "./index.css";
|
|||
|
||||
const root = document.getElementById("root");
|
||||
|
||||
render(
|
||||
() => (
|
||||
<Router>
|
||||
<Root />
|
||||
</Router>
|
||||
),
|
||||
root!
|
||||
);
|
||||
render(() => <Router root={Root} />, root!);
|
||||
|
|
Loading…
Reference in a new issue