This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-25
Channels
- # aws (2)
- # aws-lambda (2)
- # beginners (95)
- # boot (47)
- # cider (13)
- # clara (5)
- # cljs-dev (36)
- # cljsjs (9)
- # clojure (51)
- # clojure-austin (1)
- # clojure-greece (25)
- # clojure-italy (4)
- # clojure-japan (10)
- # clojure-russia (13)
- # clojure-spec (61)
- # clojure-uk (25)
- # clojurescript (26)
- # core-matrix (5)
- # cursive (8)
- # data-science (7)
- # datomic (43)
- # dirac (2)
- # emacs (8)
- # events (3)
- # fulcro (17)
- # graphql (29)
- # jobs-rus (4)
- # lambdaisland (4)
- # lein-figwheel (3)
- # leiningen (60)
- # luminus (15)
- # lumo (8)
- # mount (3)
- # off-topic (28)
- # om (22)
- # onyx (115)
- # other-languages (6)
- # pedestal (5)
- # re-frame (41)
- # reagent (12)
- # ring-swagger (12)
- # shadow-cljs (127)
- # unrepl (27)
- # yada (5)
I don’t plan on hosting it elsewhere at the moment. The com enterprise is the consulting company. fulcro itself is open source non-commercial.
Will project migrate to react as a NPM dependency in the future?
@sundarj root can't have an ident
it doesn't work, you have to wrap it
@wilkerlucio ah, so i need to move the form out into its own component?
yeah, what I do is have a default root that I use on my apps to wrap my actual root
something like this:
(om/defui ^:once Root
static fulcro/InitialAppState
(initial-state [_ _] {:ui/react-key (random-uuid)
:ui/root (fulcro/get-initial-state ActualRoot {})})
static om/IQuery
(query [_] [{:ui/root (om/get-query ActualRoot)}
:ui/react-key])
static css/CSS
(local-rules [_] [])
(include-children [_] [ActualRoot])
Object
(render [this]
(let [{:keys [ui/react-key ui/root]} (om/props this)]
(dom/div #js {:key react-key}
(actual-root root)))))
this is a good pattern to follow, because this way you root gets easier to be plugged in another system
no problem
@sundarj pro tip: if you find yourself having to do it too much, this function can help:
(defn make-root [Root]
(om/ui
static fulcro/InitialAppState
(initial-state [_ params] {:ui/react-key (random-uuid)
:ui/root (fulcro/get-initial-state Root params)})
static om/IQuery
(query [_] [:ui/react-key
{:ui/root (om/get-query Root)}])
static css/CSS
(local-rules [_] [])
(include-children [_] [Root])
Object
(render [this]
(let [{:ui/keys [react-key root]} (om/props this)
factory (om/factory Root)]
(dom/div #js {:key react-key}
(factory root))))))
on this, you send the component, and it generates Root wrapping your component, so you don't have to write it every time
@wilkerlucio oh, neat! thanks a lot 🙂