Fork me on GitHub
#clojurescript
<
2018-04-11
>
kurt-o-sys05:04:12

when writing a plain webapp in cljs using hiccup templating, who uses which library (`weavejester/hiccup`, teropa/hiccup, ...?) and why?

👍 4
4
delaguardo09:04:25

I found for my project convenient library that can combine hiccup syntax and “I don’t want to use react in any form” - http://documentup.com/aaronc/freactive

kurt-o-sys17:04:00

oh yeah, I remember that from last year... not much seems to have moved since than. But I'll check it again! Thx.

kurt-o-sys09:04:28

seems nobody is using cljs with plain non-react-wrapper hiccups?

blackawa09:04:40

@kurt-o-sys I do not use non-react-wrapper hiccups with cljs, but you can check macchiato framework by yogthos. This is official example application which uses macchiato/hiccups . https://github.com/macchiato-framework/examples/blob/master/guestbook/src/guestbook/routes.cljs Hope it will help you. 🙏

kurt-o-sys09:04:23

ok, thx... macchiato includes backend (and seems to have focus on interaction between front and back end). But it uses weavejester/hiccup, that answers my question. So far the score is: weavejester/hiccup: 1 teropa/hiccup: 0 🙂

dehli15:04:58

Hello all. I’m trying to write a function/macro that accomplishes the following.

(defn my-func [state] 
  (fn [] {:hello state}))

(defn test []
  (with-state "world" [my-func]
    (fn []
      (my-func)))) ;; Returns {:hello "world"}
My current function looks something like:
(defn with-state [state functions body]
  (doseq [f functions]
    (intern *ns* ??? (f state)))
  body)
but I can’t figure out how to override the function that is passed in. Anyone have ideas?

darwin15:04:46

I’m not sure what exactly you want to do. But you must realize that under normal circumstances clojurescript macros are clojure code. So calling intern in clojure will create a var in clojure, not in clojurescript.

dehli15:04:05

Gotcha. This isn’t a macro, but I could also use (def) instead.

dehli15:04:05

Basically I want to get around having to do this:

(defn test [state]
  (let [my-func1 (my-func1 state)
        my-func1 (my-func2 state)
        my-func3 (my-func3 state)]

dehli15:04:55

Oh, that’s very cool! Thanks so much 🙂

darwin15:04:39

you should def the state beforehand by hand and pass symbol name into the macro as a first param

darwin15:04:18

you can make it part of the macro-generated code, but I don’t think it is a good practice to bake defs into macros (without them clearly being named defsomething)

dehli15:04:58

Cool! Currently it’s being done that way anyways so it works out. Appreciate your time!

🍻 4
darwin15:04:44

have to go, good luck

👋 4