Hello,
I'm using Om, and for some components I'm using materialui React library. For
that, I need to wrap my "root" component in a call to React.CreateClass with
some properties. Ex:
(defn foo-root [component]
(fn [data _owner]
(reify
om/IRender
(render [_]
(let [ctor (js/React.createFactory
(js/React.createClass
#js
{
:getDisplayName (fn [] "muiroot-context")
:childContextTypes #js {:muiTheme
js/React.PropTypes.object}
:getChildContext (fn [] #js {:muiTheme *mui-theme*})
:render (fn [] (js/React.cloneElement (component
data)))}))]
(ctor. nil))))))
MaterialUI components need to access to :muiTheme through getChildContext().
This was working fine, but unfortunately, something doesn't play well with this
and local state of Om components. When I update the local state, using
om/set-state! looks like it updates it but the component isn't re-rendered. If
I test the same code without wrapping it into this foo-root function, it
re-render the component correctly.
Do you have any idea of what can be wrong? Is there another way to deal with Om
& getChildContext()
I uploaded here [1] an example of the code. I hope this could be useful for you.
Thank you!
[1] https://gist.github.com/areina/b7df181ca2f17671f300
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.