This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-12
Channels
- # aleph (5)
- # announcements (1)
- # asami (29)
- # babashka (2)
- # beginners (36)
- # biff (1)
- # cider (6)
- # clj-kondo (29)
- # clj-together (5)
- # clojars (21)
- # clojure (11)
- # clojure-austin (5)
- # clojure-czech (1)
- # clojure-europe (23)
- # clojure-hk (1)
- # clojure-italy (1)
- # clojure-nl (1)
- # clojure-uk (1)
- # clojurescript (38)
- # clojurewerkz (1)
- # cursive (10)
- # data-science (2)
- # datalevin (15)
- # datomic (8)
- # duct (5)
- # emacs (36)
- # events (4)
- # fulcro (7)
- # garden (1)
- # gratitude (1)
- # interop (4)
- # introduce-yourself (1)
- # leiningen (1)
- # missionary (3)
- # music (3)
- # nbb (4)
- # off-topic (21)
- # polylith (6)
- # remote-jobs (5)
- # shadow-cljs (19)
- # specter (4)
- # xtdb (4)
How can I setup a route to "http://example.com", "http://example.com/"? I'd like to have a router in the root component. I'd like the landing page to be a route target. But route targets cannot be empty. (dynamic routing)
So you have two problems: (1) you want some-path/
and some-path
to route to the same component and (2) you want the Root to be route target. Correct?
For (1) I would leave that outside of dyn. routing and put it instead in the glue code between URLs and Fulcro routes. A kind of "normalization" of the route.
For (2) I do not understand why would you want that. There is just a single root component (otherwise it would not be a root) so routing at that level does not make sense. Could you explain you use case?
It makes sense to me to place a router in the root component. That way, a router is in full control of which page is being shown. But I also want a landing page to be shown when there is no path string (http://example.com or http://example.com/). I'm scratching my head as to how to send the user to this route since it has no path segments and you cannot declare a route-target for [] or [""].
I've used routers in the past where I can define it like:`["" {:map of route data} ["/subroute" {:map of sub-route data}]`
Then have a single Root component that includes a router child with different Page targets.
> I'm scratching my head as to how to send the user to this route since it has no path segments As mentioned, url != route. In the glue code between the two you can make "" to a route such as "default" or whatever. I do st. similar here https://github.com/holyjak/fulcro-billing-app/blob/main/src/shared/billing_app/client.cljs#L155
Okay, so I might be able to give the component a route-segment such ["landing"] and then change this to and from "" in whatever history updater I use. Thank you, I'm going to look into that.