Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Last active August 29, 2015 14:08
Show Gist options
  • Save svetlyak40wt/728ccb1f04d08f96d827 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/728ccb1f04d08f96d827 to your computer and use it in GitHub Desktop.
Testing jisp as react's JSX replacement
(mac mknode name
`(mac ,name ,attrs ,children
`(fn ((get React.DOM name) ,attrs ,children))))
(mknode div)
(mknode ul)
(mknode p)
; ...
(= CommentBox (React.createClass
(displayName: "CommentBox"
render: (div (className: "commentBox")
"Hello, world! I am a CommentBox."))))
(React.renderComponent
(CommentBox null)
(document.getElementById "react-content"))
(= CommentBox (React.createClass
(displayName: "CommentBox"
render: (fn (React.DOM.div (className: "commentBox")
"Hello, world! I am a CommentBox.")))))
(React.renderComponent
(CommentBox null)
(document.getElementById "react-content"))
var CommentBox = React.createClass({displayName: 'CommentBox',
render: function() {
return (
React.DOM.div({className: "commentBox"},
"Hello, world! I am a CommentBox."
)
);
}
});
React.renderComponent(
CommentBox(null),
document.getElementById('content')
);
(def mknode name
(fn attrs children
)))
(= div (mknode "div"))
(= CommentBox (React.createClass
(displayName: "CommentBox"
render: (div (className: "commentBox")
"Hello, world! I am a CommentBox."))))
(React.renderComponent
(CommentBox null)
(document.getElementById "react-content"))
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
Hello, world! I am a CommentBox.
</div>
);
}
});
React.renderComponent(
<CommentBox />,
document.getElementById('content')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment