1

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"]]]]))

1 Answer 1

1

Do you have the correct filename and is it on the classpath?

Assuming you have :source-paths ["src"] then the expected filename would be src/reagent_project/utils/path_for.cljs? Note that - is required to be turned into a _ for .clj(s) source files.

Sign up to request clarification or add additional context in comments.

1 Comment

renaming path-for.cljs to path_for.cljs fixed it. thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.