1

I have this def in myapp.core (core.cljs):

(def router 
    (reitit/router [["/" {:name :foo :view #'foo}]])
)

And in myapp.events (events.cljs), I use it like so:


{:dispatch [:common/navigate (reitit/match-by-path myapp.core/router "/browse")]}

But I get the error:


{:dispatch [:common/navigate (reitit/match-by-path myapp.core/router "/browse")]
--------------------------------------------------------------------^-----------
 Use of undeclared Var myapp.core/router
--------------------------------------------------------------------------------
1385 |            }

Why would that be?

zendevil.eth
  • 974
  • 2
  • 9
  • 28

1 Answers1

2

Since you are using the full name myapp.core/router I assume you don't have a proper require for that namespace in your ns form.

You must have (:require [myapp.core]) in that ns, preferably with an :as alias and using that. It is not allowed to "cheat" by using the full name.

Thomas Heller
  • 3,842
  • 1
  • 9
  • 9