fix for Use of undeclared Var re-frame.core/subscribe

This commit is contained in:
Roman Volosovskyi 2017-10-11 08:53:11 +02:00
parent c7893ebd17
commit 11f410f3af
1 changed files with 18 additions and 15 deletions

View File

@ -48,18 +48,21 @@
2 [(first rest-body') {} (second rest-body')]
3 rest-body')
[subs-bindings vars-bindings] (prepare-subs subs)]
`(defn ~n ~params
(let [~@subs-bindings]
(reagent.core/create-class
(merge ~(->> component-map
(map (fn [[k f]]
(let [args (gensym "args")]
[k `(fn [& ~args]
(let [~@vars-bindings]
(apply ~f ~args)))])))
(into {}))
{:display-name (name '~n)
:reagent-render
(fn ~params
(let [~@vars-bindings]
~body))}))))))
`(do
(when-not (find-ns 're-frame.core)
(require 're-frame.core))
(defn ~n ~params
(let [~@subs-bindings]
(reagent.core/create-class
(merge ~(->> component-map
(map (fn [[k f]]
(let [args (gensym "args")]
[k `(fn [& ~args]
(let [~@vars-bindings]
(apply ~f ~args)))])))
(into {}))
{:display-name (name '~n)
:reagent-render
(fn ~params
(let [~@vars-bindings]
~body))})))))))