react/docs/_js/jsx-compiler.js
Daniel Lo Nigro eab1f4d366 Simple HTML to JSX converter, built during Hackathon 40 at Facebook.
See /react/html-jsx.html. Not directly linked from the site yet as there may still be some minor issues with it.
2013-12-21 17:44:38 -08:00

27 lines
549 B
JavaScript

/**
* @jsx React.DOM
*/
var HELLO_COMPONENT = "\
/** @jsx React.DOM */\n\
var HelloMessage = React.createClass({\n\
render: function() {\n\
return <div>{'Hello ' + this.props.name}</div>;\n\
}\n\
});\n\
\n\
React.renderComponent(<HelloMessage name=\"John\" />, mountNode);\
";
var transformer = function(code) {
return JSXTransformer.transform(code).code;
}
React.renderComponent(
<ReactPlayground
codeText={HELLO_COMPONENT}
renderCode={true}
transformer={transformer}
/>,
document.getElementById('jsxCompiler')
);