Fork me on GitHub
#reagent
<
2016-01-20
>
peterbak03:01:54

has anyone here integrated a piece of plain vanilla JS code into a CLJS+reagent app? any words of wisdom?

peterbak03:01:09

(reimplementation in cljs is out of the question)

peterbak03:01:08

should i be wrapping it in a react component and then somehow make my main reagent/re-frame app use it, or something like that?

mikethompson03:01:46

Is this component already a React component?

mikethompson03:01:31

@peterbak: ^^ I'm going to assume not. In which case, use this technique: https://github.com/Day8/re-frame/wiki/Using-Stateful-JS-Components

peterbak04:01:50

ah, yes, just the guidance I need! thanks so much @mikethompson

pepe07:01:58

@gadfly361: btw, the soda-ash demo is very nice demonstration of devcards. Really appretiated! Thanks

gadfly36110:01:50

@pepe Thanks! Should be pushing out a new release in the next day or two. Will include a new devcard page going over some of the core concepts that I've neglected to document so far.

pepe10:01:19

@gadfly361: I am actually eager to use it on some future project, just for the taste of the Semantic UI. Ping me after the release, please. I would love to review what’s new

gadfly36110:01:49

@pepe it should round out the Elements portion of Semantic. One breaking change.. removing :group? option and replacing with plural versions of the elements. As an aside, i would advise only using soda-ash in toy projects for a while until the api stabilizes. Hoping to get feedback from you and others who are testing it out :)

hugobessaa11:01:17

@mikethompson: re-frame's wiki is one of the best gems about reagent out there. Thanks simple_smile

mikethompson12:01:51

Thanks @hugobessaa. Always very nice to get positive feedback.

hugobessaa12:01:27

open source maintainers diserve that! specially when doing great work

hugobessaa12:01:59

hope to help you out in a few weeks

rohit15:01:07

shameless self promotion: I've got an example here which shows how to use react-timer-mixin with reagent. The problem being solved is: sometimes in a search bar you want a delay before the UI is refreshed. I found examples of this in cljs world using core.async but I wanted to build something a lot simpler. hence this example: https://github.com/ducky427/reagent-timer-demo

rohit15:01:03

In this example, the text is filtered 600ms after there is a change in the search input text box

rohit15:01:57

feedback welcome

mbertheau15:01:55

@rohit: does the mixin do anything? It looks like you're implemeting the delay yourself completely

rohit15:01:11

@mbertheau: actually it gives you safe access to setTimeOut. from the docs of the mixin:

rohit16:01:03

>Using bare setTimeout, setInterval, setImmediate and requestAnimationFrame calls is very dangerous because if you forget to cancel the request before the component is unmounted, you risk the callback throwing an exception.

rohit16:01:31

>If you include TimerMixin, then you can replace your calls to setTimeout(fn, 500) with this.setTimeout(fn, 500) (just prepend this.) and everything will be properly cleaned up for you.

mbertheau16:01:31

I see. Interesting! Thanks

rohit16:01:07

I've first saw the pattern while looking at the Movies app example in react-native #C0E1SN0NM

gadfly36122:01:07

@pepe ping (just put out a new soda-ash)