how to switch the route in reagent project? i use lein new reagent app to create an app, i want to create button which will send a request to backend and switch route into route :app after it, how should i do?
Supposing :app is located at /app :
(defn jump [to]
(session/update! :route
merge
{:current-page to})
(.pushState (.-history js/window) nil "" "/app"))
This changes the URL to
(.pushState (.-history js/window) nil "" "/app") should probably be done in the side-effecty function session/update!
I recommend a client-side routing solution like reitit if you have a more complex app.thank you, it work!!!
(defn jump [to]
(session/update! :route
merge
{:current-page to}))
this one will change the app layout, but the url in location won't change, how should i to change the locationL