Re: [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
Hi Dan, This seems like a really smart approach to me. I've been playing with a number of ways of structuring a large Cljs application recently - and the way Cloact cooperates with atom derefs is pretty inspired. It's flexible, it's fast, it's natural - and it makes transition from a non-React codebase easy (trivial in my case since I already using Hiccup). Seriously great stuff, thank you for sharing this! BTW for those looking for single-state snapshots (for undos, tooling, debugging, etc.) - all you'd need to do is merge any individual atom snapshots that constitute your full application state. It should be easy to extend Cloact (or something like Reflex https://github.com/lynaghk/reflex) to do the state tracking automatically. Cheers! :-) - Peter Taoussanis -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
Thanks a lot Peter! Btw, there is already code that comes from Reflex in Cloact (even if it is mangled quite a bit by now). Very undocumented, and probably a very poor api, though... See ratom.clj/.cljs. There is for example a run! macro that will execute its body every time a deref'ed atom is changed. Quite another thing is if it is a good idea to do that :-) If possible, I'd say it is better to keep state that belongs together in a single atom. /dan On 11 jan 2014, at 16:58, Peter Taoussanis ptaoussa...@gmail.com wrote: Hi Dan, This seems like a really smart approach to me. I've been playing with a number of ways of structuring a large Cljs application recently - and the way Cloact cooperates with atom derefs is pretty inspired. It's flexible, it's fast, it's natural - and it makes transition from a non-React codebase easy (trivial in my case since I already using Hiccup). Seriously great stuff, thank you for sharing this! BTW for those looking for single-state snapshots (for undos, tooling, debugging, etc.) - all you'd need to do is merge any individual atom snapshots that constitute your full application state. It should be easy to extend Cloact (or something like Reflex https://github.com/lynaghk/reflex) to do the state tracking automatically. Cheers! :-) - Peter Taoussanis -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to a topic in the Google Groups ClojureScript group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/4b8ZL_4P4ZA/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescr...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
Quite another thing is if it is a good idea to do that :-) If possible, I'd say it is better to keep state that belongs together in a single atom. Am looking at this from a performance point of view. You're marking components as dirty when there's any change in an atom being deref'ed by the component, right? But I'm guessing it's quite common for a component to be dealing with only a small subset of the data within a larger state atom. (This is what Om's cursors are addressing, it seems). In that case (please correct me if I'm wrong) - the number of needless rerenders will grow with the number of component-irrelevant bits of information in each atom. One simple way of addressing that is to use more, smaller atoms - or to use views on atoms (as Reflex does). For example instead of marking a component as dirty when @my-atom changes, we could mark it as dirty only when `(:relevant-submap @my-atom)` changes. Does that make sense, or am I misunderstanding something? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
On 11 jan 2014, at 18:51, Peter Taoussanis ptaoussa...@gmail.com wrote: Am looking at this from a performance point of view. You're marking components as dirty when there's any change in an atom being deref'ed by the component, right? But I'm guessing it's quite common for a component to be dealing with only a small subset of the data within a larger state atom. (This is what Om's cursors are addressing, it seems). In that case (please correct me if I'm wrong) - the number of needless rerenders will grow with the number of component-irrelevant bits of information in each atom. One simple way of addressing that is to use more, smaller atoms - or to use views on atoms (as Reflex does). For example instead of marking a component as dirty when @my-atom changes, we could mark it as dirty only when `(:relevant-submap @my-atom)` changes. Right, you could do that (there is a reaction macro in ratom.clj that is exactly a view on atoms). But it would probably be better to just pass (:relevant-submap @my-atom) to a sub-component. The subcomponent will only be re-rendered when its arguments (i.e the params map and possible children) changes. Also, React is fast enough that a few re-renderings won't even be noticeable most of the time. Unless React actually has to change the DOM the cost is very low. /dan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
But it would probably be better to just pass (:relevant-submap @my-atom) to a sub-component. The subcomponent will only be re-rendered when its arguments (i.e the params map and possible children) changes. Ahh, gotcha. Of course, thank you! Also, React is fast enough that a few re-renderings won't even be noticeable most of the time. Unless React actually has to change the DOM the cost is very low. Okay, also good to know. Very excited to start playing with this properly soon. All the best, cheers! :-) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
Cloact is a minimalistic interface between ClojureScript and React.js, that now has a proper introduction, some documentation and a few examples here: http://holmsand.github.io/cloact/ Project page and installation instructions are here: https://github.com/holmsand/cloact Enjoy, /dan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
Looks very nice :) On Friday, January 10, 2014, Dan Holmsand wrote: Cloact is a minimalistic interface between ClojureScript and React.js, that now has a proper introduction, some documentation and a few examples here: http://holmsand.github.io/cloact/ Project page and installation instructions are here: https://github.com/holmsand/cloact Enjoy, /dan -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com javascript:;. To post to this group, send email to clojurescr...@googlegroups.comjavascript:; . Visit this group at http://groups.google.com/group/clojurescript. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ClojureScript] [ANN] Cloact 0.1.0 - Yet another React wrapper for ClojureScript
On Friday, January 10, 2014 5:23:19 PM UTC+1, David Nolen wrote: Looks very nice :) Thanks! /dan -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.