Open chrisvfritz opened 9 years ago
Looks great! We came up with something very similar for Arch, have a look at https://github.com/arch-js/arch/blob/master/src/dom.ls. It's all written and meant to be used with LiveScript, btw :)
I like it! As a (relative) newcomer to LiveScript, it's great to see examples in the wild with a more functional style, which I'm still slowly adapting myself to. :smiley: I'll be keeping my eye on Arch!
That's help ! :)
That's a great solution. I am researching to use React but want to get rid of the JSX hell lately.
However I think '_' is a better choice over '$' for a few reasons:
Since you don't use JSX in your LiveScript components (and aren't using jQuery, so
$
is available), I thought I'd share this improved interface I use forReact.create-element
:This allows me to build components in my
render
method like this:A few significant advantages here:
React.DOM
elements I'm using in each component, but I also don't have a bunch of single character functions such asa
,i
,p
, etc cluttering my global scope.React.create-element
.$dom-element
acts as a partial application of$
(i.e.$p ...
is the same as$ 'p', ...
).$ MyComponent, null
or$ MyComponent, null, 'contents or children'
. You can just write$ MyComponent
and$ MyComponent, 'contents or children'
respectively.Thoughts?
I'd love to hear what others think about this, especially if you notice/anticipate any problems with it. It's great to see other LiveScripters using React! :smiley: