Fork me on GitHub
#reitit
<
2022-03-30
>
FlavaDave21:03:13

Im having a hard time understanding the docs on how to use rfe/push-state. I want to do a simple navigation but (rfe/push-state "#/" nil nil) doesn’t do anything. Obviously I’m doing something wrong but I don’t know what?

wevrem03:03:13

The first argument to push state should be the name of a route, something like

(rfe/push-state :home-page)
assuming you have a route defined something like this:
["/" {:name :home-page}]
If your route has path- or query- params, those are additional arguments (as maps) to push-state, something like this:
(def route-data
  ["/" {:name :home-page}
   ["/user/:user" {:name :user-route}]])

(rfe/push-state :user-route {:user "fred"})
which will update the browser location (navigate) to URL “/user/fred”.