This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-19
Channels
- # adventofcode (1)
- # announcements (3)
- # babashka (60)
- # beginners (60)
- # calva (5)
- # clj-commons (17)
- # clj-kondo (33)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (3)
- # clojure-europe (19)
- # clojure-gamedev (25)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sweden (4)
- # clojure-uk (2)
- # clojurescript (27)
- # conjure (1)
- # core-async (1)
- # core-typed (7)
- # cursive (5)
- # datomic (35)
- # events (1)
- # fulcro (35)
- # integrant (7)
- # introduce-yourself (2)
- # kaocha (5)
- # leiningen (2)
- # lsp (26)
- # malli (13)
- # nbb (99)
- # off-topic (15)
- # pathom (12)
- # pedestal (5)
- # polylith (8)
- # portal (4)
- # rdf (19)
- # reagent (8)
- # reitit (5)
- # releases (2)
- # remote-jobs (2)
- # rewrite-clj (1)
- # shadow-cljs (94)
- # testing (2)
- # timbre (2)
- # tools-deps (16)
I’ve written this function a few times in different projects — is there a built-in way to do this? Could I send a PR?
(defn path
"Generate a path from the router"
([router name] (path router name nil nil))
([router name path-args] (path router name path-args nil))
([router name path-args query-args]
(let [route (reitit/match-by-name! router name path-args)]
(assert route (str "Missing route " (str name)))
(reitit/match->path route query-args))))
in reitit.frontend.history it's called href https://github.com/metosin/reitit/blob/43e1a520d60aefa6bd7c67316b92f170c1e6d447/modules/reitit-frontend/src/reitit/frontend/history.cljs#L174-L181 so if you do send a pr it might be a good idea to use href as a name?