pickstack

SolidJS + Solid Router

The official SolidJS router; App acts as the root layout. This page shows exactly what pickstack adds to a SolidJS project for Solid Router: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework solid --modules solid-router --yes
Customize in the configurator

Packages it adds

PackageVersionType
@solidjs/router^1.0.3runtime

New files

src/pages/About.tsx
export default function About() {
  return (
    <section class="page">
      <h1 class="title">About</h1>
      <p class="text">Built with SolidJS, Vite, TypeScript, Solid Router.</p>
    </section>
  );
}
src/pages/Home.tsx
import Counter from "../components/Counter";

export default function Home() {
  return (
    <section class="page">
      <h1 class="title">my-app</h1>
      <Counter />
    </section>
  );
}

Changes to existing files

src/App.tsx (changed)
+import type { RouteSectionProps } from "@solidjs/router";+import { A } from "@solidjs/router";−import Counter from "./components/Counter";  +export default function App(props: RouteSectionProps) {−export default function App() {   return (     <main class="app">+      <nav class="nav">+        <A class="link" href="/">+          Home+        </A>+        <A class="link" href="/about">+          About+        </A>+      </nav>+      {props.children}−      <h1 class="title">my-app</h1>−      <Counter />     </main>   ); }⋯ 1 unchanged lines
src/index.tsx (changed)
 /* @refresh reload */+import { Route, Router } from "@solidjs/router"; import { render } from "solid-js/web"; import App from "./App";+import About from "./pages/About";+import Home from "./pages/Home"; import "./index.css";   const root = document.getElementById("root");  +render(+  () => (+    <Router root={App}>+      <Route path="/" component={Home} />+      <Route path="/about" component={About} />+    </Router>+  ),+  root!,+);−render(() => <App />, root!);  

Project files

Related templates