Fork me on GitHub
#reagent
<
2016-09-13
>
eyelidlessness02:09:14

^ re above interop, i often find it convenient, if i don't have to refer to a local binding or var, to just dot-access the whole thing, e.g. (js/window.history.back)

artur07:09:19

@eyelidlessness works like a charm, thanks!

jumar09:09:22

Hello, I’m trying to create a simple google map with some locations markers - however, I’m not able to display the map on refresh

jumar09:09:47

If I got it correctly, the problem is that the component-did-mount is not called when ratom is changed

jumar09:09:51

code is as follows:

jumar09:09:28

locations are fetched from backend asynchronously

jumar09:09:12

I’ve just read https://github.com/Day8/re-frame/wiki/When-do-components-update%3F but still not sure how I should solve this issue.

artur09:09:43

@gamecubate here is the repo for the MtG card search application we discussed yesterday: https://github.com/mtg-cards

juhoteperi11:09:50

Oh... :ref can't be used with :input etc...

juhoteperi11:09:25

IE11 fix on the latest snapshot always overrides :ref

gamecubate15:09:06

@artur Thanks a lot for this. BTW well organized project. It makes understanding the inners that much easier. I see you use secretary for your front-end and a clojure back end server . I'd always assumed that CLJS work was easiest served up-front (hosted index.html, app.js and friends). Your setup provides a clear alternate path: dynamic backend page generation and delivery, coupled to front-end routing. Not wrapping my mind very well around this. Will dig deeper. Thanks for the great (starred) example.

gamecubate15:09:04

@artur Also wondering if secretary is needed if one uses re-frame, as I was contemplating.

artur15:09:16

I have no idea about re-frame as this is the only setup I have done so far. I like how I can package everything in one JAR file that I can fire up and use without the need for Nginx or other instance to serve the index.html file.

artur15:09:50

I need to check out re-frame though. Don't even know what that is 😊

gamecubate15:09:25

Well, not having worked with it yet but tempted because of the complexities of my current work project (cljs + reagent for NHL games newspaper contest front-end, nodejs backend 2-tier servers, mongodb). Re-frame is a relatively small lib/namespace coupled to a well documented approach in its use. With it, a clear separation of concerns is enforced, simplifying complex app coding.

gamecubate15:09:46

Long story short: re-frame helps keep chaos at bay.

gamecubate15:09:12

I guess you still need some nginx config to proxy ports to subdomain URLs but yes, your approach simplifies deployments. Being lazy myself, I use Makefiles for that. 🙂

artur17:09:33

Yes, deployment is easy, I just scp one file 🙂

artur17:09:22

And as for chaos, I have seperated app state into one file, actions which modify state into one file and then there are pages and components.

artur17:09:23

Oh and routes are also in one file

artur17:09:53

I kind of imitate Redux but made it little simpler by omitting reducers and stores

artur17:09:34

Merged reducers and actions

curlyfry17:09:01

@artur: re-frame is similar to redux in many ways

curlyfry17:09:55

Highly recommend it btw!

artur17:09:42

will have a look, thanks

shaun-mahood17:09:29

@gamecubate: secretary and re-frame handle different concerns - secretary is primarily there to allow you to deal with URL routing, and can be used along with re-frame (as can Bidi, Silk, or another URL routing library). To see an example of secretary used with re-frame, check out https://github.com/yogthos/memory-hole or for bidi check out https://pupeno.com/2015/08/26/no-hashes-bidirectional-routing-in-re-frame-with-bidi-and-pushy/

gamecubate17:09:18

@shaun-mahood Thanks for the links. The Bidi example is very nicely explained, as are Bidi and Pushy. Added to my stack. 🙂

bill_tozier18:09:47

Dopey question, possibly because I need caffeine and a nap: If I want to render markdown converted to HTML in a reagent component, how can I best do that?

artur18:09:31

Is there a MD library?

gamecubate18:09:49

@bill_tozier You could try something like this: [:div {:dangerouslySetInnerHTML {:__html "<b>I am bold</b>"}}] .

bill_tozier18:09:22

@gamecubate So basically call markdown-clj or showdown (depending on the situation) to convert some MD text to HTML, then dangerouslySetInnerHTML.

bill_tozier18:09:48

So no “pass-through HTML component” I’m missing? I know, the philosophy of react and all. Just checking.

gamecubate18:09:04

@bill_tozier That’s I would try. Later would seek something smoother if time allows.

gadfly36119:09:17

@bill_tozier this may be of interest since it is in the same realm, but doesn't do what you are looking for: https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/markdown-editor

artur19:09:18

Is there a neat way to use third party React JS components in Reagent?

gadfly36119:09:45

@artur Try adapt-react-class

artur19:09:39

Now I need to figure out how to plug npm with my reagent app. Thanks guys!

gadfly36119:09:56

@gamecubate Your reddit link also shows this: [:> nativeComp {:key "value"}], so :> looks like shorthand for adapt-react-class (as of reagent v0.6.0-alpha). Thanks for sharing!

gamecubate19:09:02

@gadfly361 You’re welcome. Between work and life, I can barely keep up with the Reagent changes but they are nice, not too frequent and always well documented. Great lib.