The result is here:
https://github.com/holmsand/cloact
Cloact uses plain cljs functions to define React components, and a Hiccup-y syntax for stringing them together.
Performance seems to be quite good, especially in advanced-compilation-mode. Cloact uses shouldComponentUpdate to avoid any unnecessary rendering, and so avoids the cost of converting from cljs vectors and maps a lot of the time.
Cloact comes with a couple of silly examples:
https://github.com/holmsand/cloact/blob/master/examples/simple/src/simpleexample.cljs
(a fancy clock that even can change color) and
https://github.com/holmsand/cloact/blob/master/examples/todomvc/src/todomvc.cljs
(the obligatory todomvc implementation).
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 clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
I’m running in my browser, right now, a function that updates the render state and React is given the opportunity to redraw before the function continues (i.e. it re-renders right after the swap!). This is certainly within the rules. If you have multiple atoms that need to be updated then you’ll potentially see React re-render between each atom update… i.e. there will be React renders where the atom values are uncoordinated/inconsistent (possibly doing silly stuff on the screen, momentarily at least). I can imagine some very crude techniques to prevent this, do you know any good ones (beside putting all state in one atom (which, personally, I had been planning to do anyway))?
On 13 jan 2014, at 18:41, Bob Hutchison <hutch...@recursive.ca> wrote:
I’m running in my browser, right now, a function that updates the render state and React is given the opportunity to redraw before the function continues (i.e. it re-renders right after the swap!). This is certainly within the rules. If you have multiple atoms that need to be updated then you’ll potentially see React re-render between each atom update… i.e. there will be React renders where the atom values are uncoordinated/inconsistent (possibly doing silly stuff on the screen, momentarily at least). I can imagine some very crude techniques to prevent this, do you know any good ones (beside putting all state in one atom (which, personally, I had been planning to do anyway))?
Aah, I see. That is a very good question: most of the time you shouldn't see any inconsistent output, since React normally batches updates – but only in React's own event handlers. There are ways around that, but none of them are very attractive...
Aah, I see. That is a very good question: most of the time you shouldn't see any inconsistent output, since React normally batches updates – but only in React's own event handlers. There are ways around that, but none of them are very attractive...FWIW, this is something I wanted to solve in Om. Application state updates are *always* batched, rendering always occurs on requestAnimationFrame (where available), and there's some basic enforcement logic around trying to update the app state from event handlers to work around inconsistency.