6 changed files with 8 additions and 91 deletions
@ -1,46 +0,0 @@ |
|||
var HELLO_COMPONENT = "\ |
|||
var HelloMessage = React.createClass({\n\ |
|||
render: function() {\n\ |
|||
return <div>Hello {this.props.name}</div>;\n\ |
|||
}\n\ |
|||
});\n\ |
|||
\n\ |
|||
React.render(<HelloMessage name=\"John\" />, mountNode);\ |
|||
"; |
|||
|
|||
function transformer(harmony, code) { |
|||
return JSXTransformer.transform(code, {harmony: harmony}).code; |
|||
} |
|||
|
|||
var CompilerPlayground = React.createClass({ |
|||
getInitialState: function() { |
|||
return {harmony: false}; |
|||
}, |
|||
handleHarmonyChange: function(e) { |
|||
this.setState({harmony: e.target.checked}); |
|||
}, |
|||
render: function() { |
|||
return ( |
|||
<div> |
|||
<ReactPlayground |
|||
codeText={HELLO_COMPONENT} |
|||
renderCode={true} |
|||
transformer={transformer.bind(null, this.state.harmony)} |
|||
showCompiledJSTab={false} |
|||
showLineNumbers={true} |
|||
/> |
|||
<label className="compiler-option"> |
|||
<input |
|||
type="checkbox" |
|||
onChange={this.handleHarmonyChange} |
|||
checked={this.state.harmony} />{' '} |
|||
Enable ES6 transforms (<code>--harmony</code>) |
|||
</label> |
|||
</div> |
|||
); |
|||
} |
|||
}); |
|||
React.render( |
|||
<CompilerPlayground />, |
|||
document.getElementById('jsxCompiler') |
|||
); |
@ -1,14 +1,9 @@ |
|||
--- |
|||
layout: default |
|||
layout: single |
|||
title: JSX Compiler Service |
|||
id: jsx-compiler |
|||
--- |
|||
<div class="jsxCompiler"> |
|||
<h1>JSX Compiler</h1> |
|||
<p> |
|||
This tool demonstrates how <a href="/react/docs/jsx-in-depth.html">JSX syntax</a> |
|||
is desugared into native JavaScript. |
|||
</p> |
|||
<div id="jsxCompiler"></div> |
|||
<script src="js/jsx-compiler.js"></script> |
|||
</div> |
|||
|
|||
**_This tool has been removed as JSXTransformer has been deprecated._** |
|||
|
|||
We recommend using another tool such as [the Babel REPL](https://babeljs.io/repl/). |
|||
|
Loading…
Reference in new issue