Fork me on GitHub
#reagent
<
2017-08-24
>
reefersleep07:08:05

@hugh.jf.chen what @mikethompson says is applicable for all Clojure code - the effects (and side effects, such as instantiating a reference to a subscription) of a function never occur if the function isn’t called.

reefersleep07:08:50

Sorry if I’m stating the obvious 🙂

sam1608:08:28

@mrchance but we dont have a cljsjs file for that library. (this one https://github.com/TeamWertarbyte/material-auto-rotating-carousel) How do i make one?

mrchance09:08:25

@sam16 Clojurescript has several ways to integrate js libs now, in your case you probably need :foreign-libs or something like that, please refer to http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html or https://clojurescript.org/reference/dependencies

pesterhazy12:08:07

Re: Higher Order Components, I've found that the techniques explained here work well in Reagent also: https://facebook.github.io/react/docs/higher-order-components.html

deadghost15:08:33

hmph I never have good luck integrating foreign libs

deadghost15:08:03

so I'm trying to use cljsjs/rc-slider

deadghost15:08:20

dep added, and required

deadghost15:08:19

(def slider (r/adapt-react-class js/Slider)) => Slider is not defined

pesterhazy16:08:45

@deadghost you need to require the cljsjs namespace

pesterhazy16:08:05

that causes the foreign js to be included in by the closure compiler

deadghost18:08:26

well hmm, when I include cljsjs/rc-slider I get TypeError: ReactInternals is undefined

deadghost18:08:24

I tried cljsjs react components I've successfully used in the past and they work fine

deadghost18:08:51

so seems specific to rc-slider

roosta19:08:43

Assuming you are using Reagent (you are here after all) did you exclude react and react-dom from rc-slider?

[cljsjs/rc-slider "4.0.1-0" :exclusions [cljsjs/react cljsjs/react-dom]]

deadghost19:08:05

I did not, I'll give it a go

juhoteperi19:08:38

seeing that rc-slider 4 is ~year old, it is completely possible it doesn't work with current react

roosta19:08:50

I've used it recently

roosta19:08:38

last version of react I used it on was 15.4.2, can't speak for any newer iterations

juhoteperi19:08:05

15.5 broke some libs

roosta19:08:33

ok, well you might be right then

deadghost19:08:48

excluded from rc-slider and explicitly included the versions of react it uses

deadghost19:08:02

no warnings or errors in console but not rendering

deadghost19:08:15

as in the specific component

deadghost19:08:08

do you use it with (def slider (r/adapt-react-class js/Slider)) and [slider {}]?

roosta19:08:04

yeah exactly like that

deadghost19:08:27

hmm, not sure what's going on then

roosta19:08:53

me neither sorry, at least you got rid of some compiler warings tho 🙂

yedi19:08:33

shouldn't you just be able to do [:> js/Slider]

juhoteperi19:08:11

Should work the same as adapt-react-class

deadghost19:08:55

I'm just going to give up on this for now

dimovich20:08:01

had a component that would render an image, and on :component-did-mount I was getting the size... which didn't work as expected

dimovich20:08:09

seems the actual image from [:img ...] loads a bit later after the component has mounted...

dimovich20:08:30

so in order to get the size of image, just add an :on-load event to the [:img]

dimovich20:08:38

(maybe someone bumps into this)

profgra20:08:19

Hi all, I am facing an error when testing the prod build:

dimovich20:08:31

@profgra maybe you have sth like [component1] [component2] instead of [component1 [component2]] ?

profgra20:08:33

Does someone have any clue about what it means? It's about a MenuItem (react-bootstrap component).

dimovich20:08:26

was having the same issue recently, and it was related to using reagent/children incorrectly

profgra20:08:37

Strange because the tests in the dev version was ok. Thanks anyway, I'll check my components structure.

gdeer8120:08:18

@profgra when you say prod build do you mean that you're using advanced compilation?

profgra20:08:44

:optimizations is set to :simple

profgra20:08:18

If I understand the msg correctly reagents is looking for the element keyed by ([:> #object[t ...] {:eventKey "a...59"} "Label"]) in a vec, which is kind of weird. @gdeer81 could advanced compilation be a problem?

gdeer8120:08:19

@profgra now that I look at it closer, I don't think so