Fork me on GitHub
#reagent
<
2017-03-15
>
seantempesta02:03:49

How do you inherit js-props passed into a reagent component?

seantempesta02:03:55

Ah never mind. It turns out I needed access to “context” (whatever that is). This seems like kind of a hack, so someone please tell me if there’s a more elegant way to do this.

(this-as this
    (let [showActionSheetWithOptions (aget this ["_reactInternalInstance" "_context" “showActionSheetWithOptions”)]

gordon17:03:13

@seantempesta if you're trying to access React props on a component, there's reagent.core/props http://blog.ducky.io/reagent-docs/0.6.0-alpha2/reagent.core.html#var-props

negaduck22:03:42

hello. I have an issue probably related to cljs/react-dom. I added these deps to project.clj:

[reagent "0.6.1" :exclusions [cljsjs/react]]
                 [cljsjs/react-with-addons "15.4.2-2"]
And this code doesn’t work:`
[css-transition-group {:transitionName "example" :transitionEnterTimeout 500 :transitionLeaveTimeout 500}
      (if (<sub [:move "balsero"])
        ^{:key "whatever"} [:p "balsero"])]
The error I get is TypeError: Cannot read property 'findDOMNode' of null, occurs here:
transition: function (animationType, finishCallback, userSpecifiedDelay) {
    var node = ReactAddonsDOMDependencies.getReactDOM().findDOMNode(this);
Do I need to add or exclude cljs/react-dom somewhere?

gadfly36122:03:04

@negaduck what version of cljsjs react-with-addons are you using?

gadfly36122:03:34

if you change the version of reagent to 0.6.1, then you will need to also update step 2 and use [cljsjs/react-with-addons "15.4.0-0"]

gadfly36122:03:09

i just tried it with that version of react-with-addons & reagent 0.6.1 and recipe works

negaduck23:03:28

@gadfly361, I tried it with [cljsjs/react-with-addons “15.4.2-2”] with no success

seantempesta23:03:50

@gws: Yeah, I tried that, but this “context” thing seems to be different. Things like Redux use it to pass information down through children without explicitly passing props.

dragoncube23:03:55

I’ve noticed that sometimes such definitions makes huge difference:

(defn concrete-container-1 [view-component]
  [generic-container
   :some-param-1
   :some-param-2
   view-component])

(def concrete-container-1
  (partial generic-container
   :some-param-1
   :some-param-2))

dragoncube23:03:32

specifically one with partial does not work properly (something like double rendering)

dragoncube23:03:48

is there any explanation/documentation for that?

negaduck23:03:58

@gadfly361, hm. It’s getting weird. Doesn’t work with the latest 15.4.2-2. But I’ve just tried it with [cljsjs/react-with-addons “15.4.0-0”] and it worked.

gadfly36123:03:24

I am assuming react proper has removed findDOMNode and reagent still depends on it

gadfly36123:03:43

nvm, findDOMNode still exists, just moved to ReactDOM and I think reagent looks for it there...so I'm not sure why that error happens with the bump in react version

negaduck23:03:53

@gadfly361, I’ll stick to an older version for now then. Thanks for help.