I'm trying to break out some of the page components from core.cljs from https://github.com/reagent-project/reagent-frontend-template , but am getting this error:
The required namespace "reagent-project.utils.path-for" is not available, it was required by "reagent_project/pages/home.cljs".
my files are as follows:
path-for.cljs
(ns reagent-project.utils.path-for
(:require
[reitit.frontend :as reitit]))
(defn path-for [route & [params]]
(if params
(:path (reitit/match-by-name router route params))
(:path (reitit/match-by-name router route))))
home.cljs
(ns reagent-project.pages.home
(:require
[reagent-project.utils.path-for :refer [path-for]]
[reagent.core :as reagent :refer [atom]]))
(defn home-page []
(fn []
[:span.main
[:h1 "Welcome to reagent-project"]
[:ul
[:li [:a {:href (path-for :items)} "Items of reagent-project"]]
[:li [:a {:href "/broken/link"} "Broken link"]]]]))
Do you have the correct filename and is it on the classpath?
Assuming you have
:source-paths ["src"]then the expected filename would besrc/reagent_project/utils/path_for.cljs? Note that-is required to be turned into a_for.clj(s)source files.