Live data from Hacker News

Cloact: Minimalistic React for ClojureScript

holmsand.github.io

11–20 of 45 posts

Re: Cloact: Minimalistic React for ClojureScript

#12
post #7

While I haven't had any time to play with ClojureScript, Om, React, etc. I've been keeping a pretty watchful eye, because the stack looks very appealing. One bit that doesn't look appealing to me in Om, or Cloact is the tree-building. Is there anything in ClojureScript and React right now that will let me build templates in HTML and attach functionality via attributes Angular-style?

As I suggest below I don't see why you could not compile to Om or Cloact from HTML for a friendlier presentation for designers. Still I don't think Cloact nor Om DOM syntax is particularly unapproachable for designers - I think we need some good documentation and some compelling, friendly walk-through demos (Light Table anyone? :)

Re: Cloact: Minimalistic React for ClojureScript

#13
post #10

Earlier quoted context omitted.

You can use Hiccup style with Om via sablono if you like via http://github.com/r0man/sablono . Om will never dictate nor provide an alternate syntax layer as everyone will want something different. I personally don't care for Hiccup. More importantly, Cloact is much closer to the React model while Om diverges quite a bit because we're interested in enabling patterns that are more difficult otherwise, trivial complete…

Thanks, again :) Yes, exactly, Cloact tries to stay really close to plain React. But since it allows you to separate data from rendering, undo should be quite trivial to implement (if you keep all your application data in a single cloact/atom)...

Yep sounds right to me. The other reason I did Om the way I did was to keep the door open for more React optimizations that Om can drive which are more work if you remain close to the React model - particularly only reconciling the specific children that changed in a list instead of iterating over them like React does.

Re: Cloact: Minimalistic React for ClojureScript

#14
post #9

How does this all work with non-inlined event handlers? I see a lot of on-click, on-change going on in these examples.

React inlines event handlers since it manages them through it's virtual event system.

For more information on why react breaks preconceived notions of best practices I recommend checking out http://2013.jsconf.eu/speakers/pete-hunt-react-rethinking-be...

Re: Cloact: Minimalistic React for ClojureScript

#15
post #10

Earlier quoted context omitted.

You can use Hiccup style with Om via sablono if you like via http://github.com/r0man/sablono . Om will never dictate nor provide an alternate syntax layer as everyone will want something different. I personally don't care for Hiccup. More importantly, Cloact is much closer to the React model while Om diverges quite a bit because we're interested in enabling patterns that are more difficult otherwise, trivial complete…

Thanks, again :) Yes, exactly, Cloact tries to stay really close to plain React. But since it allows you to separate data from rendering, undo should be quite trivial to implement (if you keep all your application data in a single cloact/atom)...

One thing I can't figure out is why they need to be cloact/atoms and not just regular atoms. Is it because cloact/atoms are observable?

Re: Cloact: Minimalistic React for ClojureScript

#17
post #15
post #10

Earlier quoted context omitted.

Thanks, again :) Yes, exactly, Cloact tries to stay really close to plain React. But since it allows you to separate data from rendering, undo should be quite trivial to implement (if you keep all your application data in a single cloact/atom)...

One thing I can't figure out is why they need to be cloact/atoms and not just regular atoms. Is it because cloact/atoms are observable?

In a way. Using regular atoms you can only get a callback when they are modified, but not when they are deref'ed.

You could still use regular atoms, though, with some extend-type magic. But then you risk messing with non-Cloact code in horrible ways...

Re: Cloact: Minimalistic React for ClojureScript

#18
post #2

IMHO, This look more easy to read than OM

Agreed. I'm so much more into the hiccup style tree building. This looks like something I can get into tonight. David is great but he prefers his code a little mysterious.

I think the hiccup style is a bit dangerous myself. It's great for a one-man show, or a situation where everyone who would ever have to touch the HTML is a developer, but personally I find it's a pain in my ass when it's my problem when someone else wants to insert an element into the DOM.
Post reply on HN