This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-07
Channels
Just to be clear, this code previously posted which produced an "arity 1" error ...
(defn navigation-component []
[:div [:h1 "OpenSourceFinder"]])
(defn current-page []
[:div [(session/get :current-page)]])
(defn layout-component []
[:div [(navigation-component)]
[(current-page)]])
is wrong because layout-component
will return this hiccup ....
[:div [[:div [:h1 "OpenSourceFinder"]]
[[:div [(session/get :current-page)]]]])
Take particular note of the hiccup which looks like this: [[something]]
That hiccup will cause errors because of:
https://github.com/Day8/re-frame/wiki/Using-%5B%5D-instead-of-%28%29#appendix-2It must be possible to turn the 1st element of a vector into a component
This hiccup has the same problem:
[[:div "hello"] [:div "there"]]
because the first element of the vector (which is itself a vector) can't be used to create a component.
@samueldev @coyotespike ^^^^ enquiring minds now know!
I need to build some forms with reagent. What's the status quo? reagent-forms? re-com?
@mikethompson: thank you very much for the explanation!
@petrus I can't say what's the status quo - you have re-com, you have reforms (https://github.com/bilus/reforms), you have reagent-forms. I made my own buttons, etc., but personally I like the look of re-com and may switch.
@mikethompson: thanks, that's good to know!