Fork me on GitHub
#reagent
<
2016-09-12
>
mikethompson00:09:31

@olegakbarov We occasionally use HoC (Higher Order Components) by just doing this (untested)

(defn greeter
  [name]
  [:div "Hello: " name])

(defn decorate 
  [& HoCs]
  (into [:div] HoCs))   

;; markup: 
[decorate [greeter "Spot"] [greeter "Fiddo"]]

mikethompson00:09:43

Inspect HoC (you are using clj-devtools I hope)

artur11:09:35

Got the first version done of my latest Reagent app: http://mtg.arturgajewski.com

gamecubate18:09:23

@artur nice work. What backend storage to you use?

artur18:09:40

@gamecubate This is just a front app. The API is mentioned in the About section. This app fetches data from the http://magicthegathering.io API and renders data as needed. Pictures of the Magic cards are loaded from Gatherer.

artur18:09:40

Working on listing different sets of Magic throughout the years and listing cards belonging to each set.

artur18:09:06

Upcoming work includes ability to add each card to personal Deck for proxy card printing

gamecubate18:09:27

Oh I see. Are you using cljs-ajax for the fetches?

artur18:09:31

When this is done, I will open source code on github

artur18:09:33

I use cljs-http.client to fetch data asynchronously with go function

gamecubate18:09:04

go is part of core.async IIRC (haven’t used channels yet so not sure)

gamecubate18:09:48

If so (using async), I am impressed. I’m newish (30 days-) at CLJS so haven’t tackled that beast yet. On the list of TODOs, along with re-frame.

gamecubate18:09:54

Reagent is great, all things considered.

artur18:09:02

Yup, you'll see when I put the code on github

artur19:09:17

Hmmm.... is there a way to dispatch secretary one back step? Trying to make a "Go back" button.

shaun-mahood19:09:40

@artur: I think you should be able to do something like this - http://www.w3schools.com/jsref/met_his_back.asp

artur19:09:10

how would you do it in clojurescript?

shaun-mahood19:09:53

I would just use JS interop to call it directly

artur20:09:42

(history.back js/window)

artur20:09:50

something like that?

shaun-mahood20:09:05

Not sure of the exact syntax, check out http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/ for better info than I can give you (I refer to it every time I need to do JS interop, thankfully infrequently for me).

mikethompson20:09:27

@artur shaun has supplied you with a really good resource, but if you want a shortcut use (.. js/window -history back) which results in the js window.history.back()

mikethompson20:09:41

When you are wrestling this stuff, this can be a useful site: http://app.klipse.tech/ (takes a while to load) Enter your cljs top left, wait for 3 seconds and see the generated js top right

artur20:09:52

Nice link thanks Shaun. And thanks Mike for the tip, will try it tomorrow. Now off to bed o/

tom21:09:57

When using :should-component-update with a react component that's being used in a JSX application, the first parameter appears to be the old properties. How do I get the changed/updated ones?

tom21:09:32

Example {:should-component-update (fn [new-props _] (.log js/console new-props))} shows the new props under the .-props new-props key, but when I access it that I just have the old prop values.

lvh22:09:40

yrgh, I’m updating a year-old project that has dependencies on reagent, reagent-forms, reagent-utils, and react-bootstrap

lvh22:09:56

is there a way anyone has found to not make that a giant ReactJS incompatibility mess

juhoteperi22:09:51

what do you mean by "ReactJS incompatibility mess"?

lvh22:09:35

at least some of those projects have opinions on which react version you get to have

lvh22:09:53

when a particular API disappears, like nameToPath, that causes problems

lvh22:09:06

specifically, I just had to bisect my way to a react-bootstrap that works with reagent 0.5.1

juhoteperi22:09:10

Simple solution is just to use stable React version (15.*)

juhoteperi22:09:41

Also, nameToPath sounds like Closure problem instead of React. Maybe missing dependency.