Fork me on GitHub
#reitit
<
2022-12-09
>
Mario Trost14:12:35

👋 Coming from react/react-router/remix land, I was searching for a way to do nested routes/views and if there is an Outlet (Remix) or Slot (Sveltekit) component where child routes/views would be rendered. I found some discussion here and this gist: https://gist.github.com/Deraen/4038244e3cb47d9dcb6b6e59d9e1b96a Seems good enough for me, but wanted to check quickly if that's still the way to go?

serg19:12:12

I have ended up to use names for child routes, but it’s handled all in the single root view.

["/:name"
    {:view       app-details/view
     :parameters {:path {:name string?}}}
    ["" {:name :routes/app->details}]

    ["/metrics" {:name       :routes/app->metrics
                 :parameters {:query {(ds/opt :period) string?}}}]

    ["/deployments"
     ["" {:name :routes/app->deployments}]

     ["/:id" {:name       :routes/app->deployments->details
              :parameters {:path {:id integer?}}}]]

    ["/resources" {:name :routes/app->resources}]

    ["/settings" {:name :routes/app->settings}]]
Then in app-details/view
(case active-route
          :routes/app->metrics [metrics-tab view-state]
          (:routes/app->deployments :routes/app->deployments->details) [deployments-tab view-state]
          :routes/app->resources [resources-tab view-state]
          :routes/app->settings [settings-tab view-state])