Fork me on GitHub
#reagent
<
2017-09-13
>
mikethompson00:09:09

summary: [:pre (with-out-str (pprint @interesting))]

danielneal11:09:07

heya, I just tried to upgrade reagent from 0.6.2 to 0.8.0-alpha1 in my react native project. I'm getting this error: Error: Cannot find module '@cljs-oss/module-deps' , and then undefined nameToPath for react. Has anyone seen this before and/or knows what it means?

hlolli11:09:49

Some of your library isn't useing react as module. Recommend checking this talk out that explains this a bit. If not, try npm install react https://www.youtube.com/watch?v=NjPTyBXuDGE

danielneal11:09:35

thanks, I'll listen to the talk

sivakumargsk11:09:15

i am using google reCaptcha (https://developers.google.com/recaptcha/). Its works fine in development mode. but it doesn't works in production mode. That is because of foreign-libs. I wrote externs file but that doesn't help.

danielneal13:09:54

another question, has anyone had any luck getting the :component-did-catch lifecycle method working with reagent

danielneal13:09:14

I'm using the latest react so it should be there, but as far as I can make out, the thing isn't being called

curlyfry13:09:25

@danieleneal That would depend on if Reagent has support for it though, right?

juhoteperi13:09:24

Reagent should pass additional lifecycle methods directly to React, if it doesn't have special handling for them

danielneal16:09:33

ah this is the clue I was looking for, thanks!

danielneal16:09:41

I was wondering if it passes them through

curlyfry13:09:08

@juhoteperi @danieleneal Ok, but the latest Reagent release uses React 15.5.4, and ComponentDidCatch is introduced in React 16

juhoteperi13:09:51

React 16 can be used by upgrading React deps

juhoteperi13:09:03

It will cause some additional warnings, but IIRC should work

danielneal16:09:31

yeah, I'm (attempting) to exclude reagents version of react using exclusions

danielneal16:09:08

(def react (js/require "react"))
(.-version react) => "16.0.0-alpha.12"

juhoteperi16:09:51

No need to exclude, just add new deps

danielneal08:09:20

ah, I've added the deps, and still can't get the new component-did-catch working. (.-version react) still reports "16.0.0-alpha12". I suspect that the thing that's not working is "create-react-class", which I'm guessing doesn't support the component-did-catch. Is there a way around this?

juhoteperi08:09:57

create-react-class should also pass all the methods to React

danielneal09:09:15

hmmm strange

danielneal09:09:16

I can't think of what else it might be 😬

danielneal09:09:12

but yeah, I guess you must be right - unstable_handleError works

danielneal16:09:27

Do you know anyway I can inspect the class to see if it has the lifecycle method?

danielneal16:09:42

It's not being run, and I don't know if that's because it's not there, or because I'm doing some other dumb thing

juhoteperi16:09:10

(js/console.log (r/current-component)) somewhere

Mackram17:09:34

hey everyone hope all is well with you. I would appreciate if I could get some help on a problem i am having.

Mackram17:09:55

I want to produce the html output <LineChart>...</LineChart>

Mackram17:09:19

but with reagent if I try [:LineChart] or ["LineChart]

Mackram17:09:28

both output <linechart></linechart>

Mackram17:09:11

which as I know with react would mean the proper code for that custom element will not run

reefersleep20:09:27

@mackram how about [:> LineChart]?

Mackram20:09:37

@reefersleep so if i understand correctly I should write that as [:> "LineChart"]

Mackram20:09:53

but that still produced a <linechart></linechart>

Mackram20:09:11

(i am using reagent 0.6.0)

pesterhazy21:09:11

What is LineChart - a custom dom element ?

pesterhazy21:09:53

Are Dom elements case sensitive? I thought they weren't

pesterhazy21:09:33

If you know how to do it in plain react, you can do the same from cljs

pesterhazy21:09:11

I.e. call createElement from a function

pesterhazy21:09:53

Then use [:> the-function]

Mackram21:09:28

I see interesting @pesterhazy

Mackram21:09:37

i will check out your suggestion

Mackram21:09:59

i thought too that dom elements were case insensitive but my tests show that they are not it seems

pesterhazy21:09:29

There's a wrapper create-element in Reagent's API somewhere I think

Mackram21:09:43

thanks will check it out

pesterhazy21:09:41

Or you could create the dom element yourself from component-did-mount as a child of e.g. a div

Mackram21:09:34

interestingly create-element still delivered with small letters

Mackram21:09:29

i guess something is off with what i am trying to do i will dig deeper

pesterhazy21:09:38

It's possible that react normalizes tags