Fork me on GitHub
#reagent
<
2015-08-26
>
mikethompson06:08:31

@petrus if you really need a particualr component, my suggestion is .... take the CSS from an existing component (assuming licence allows) and then replace the existing js with reagent/cljs. The look and feel of these things is often the challenging bit. The component's actual logic is typically not that hard (ie. the cljs is not that hard). And the existing js implementation acts as a pretty good spec.

mikethompson06:08:22

Then, when you are done .... donate your component to re-com (assuming MIT licence) simple_smile

shem08:08:19

i wonder if it's possible to use bits of re-com. for example if i only need a dropdown with filtering. the code seems very modular and nice.

mitchelkuijpers08:08:25

If you do advanced compilation you could just add it? it will remove all non used code anyway

shem08:08:15

hmm, that's a thought

mikethompson12:08:14

@shem yeah we went to some trouble to structure re-com so that advanced compilation could do significant dead code elimination

shem12:08:04

ok, good to know. we want to serve mobile users as well. if we only use certain components from re-com, say dropdowns, would this mean trouble with mobile users?

mikethompson12:08:44

As we make clear in the re-com readme, we don't do any work with mobile

mikethompson12:08:07

It probably works just fine, but I wouldn't like to give assurances

mikethompson12:08:26

You'll have to experiement ... and then report back simple_smile

mikethompson12:08:31

-------------- While I remember it ... for those that have joined recently ... Here is a useful debugging tip I picked up from @escherize ... When you are debugging a reagent view ... and particularly the value coming through in a cursor or subscription (re-frame) or props ... ... add something like this to the hiccup in your view ... [:pre (with-out-str (pprint @some-ratom))] ;; assuming that @some-ratom is the value you want to observe You don't even have to use pprint, you could just do this: [:pre (pr-str @some-ratom)] If you do use pprint then you'll need to require it in at the top of your view.cljs: [cljs.pprint :refer [pprint]] Further note: the advanced version of this technique is to not use pr-str or pprint but instead to use @yogthos' excellent json-html library: https://github.com/yogthos/json-html for an even more carefully arranged display.

escherize12:08:03

That is a good one, I do that all the time.