Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ecf9f0

Browse files
committed
Revert "Add --harmony option to live JSX compiler page"
This reverts commit 661bafb. (Depends on a newer version of JSXTransformer than the site currently has.)
1 parent acba66f commit 0ecf9f0

File tree

3 files changed

+10
-39
lines changed

3 files changed

+10
-39
lines changed

docs/_css/react.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,6 @@ section.black content {
454454
padding-top: 20px;
455455
width: 1220px;
456456

457-
label.compiler-option {
458-
display: block;
459-
margin-top: 5px;
460-
}
461-
462457
#jsxCompiler {
463458
margin-top: 20px;
464459
}

docs/_js/jsx-compiler.js

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,15 @@ var HelloMessage = React.createClass({\n\
1313
React.renderComponent(<HelloMessage name=\"John\" />, mountNode);\
1414
";
1515

16-
function transformer(harmony, code) {
17-
return JSXTransformer.transform(code, {harmony: harmony}).code;
16+
var transformer = function(code) {
17+
return JSXTransformer.transform(code).code;
1818
}
19-
20-
var CompilerPlayground = React.createClass({
21-
getInitialState: function() {
22-
return {harmony: false};
23-
},
24-
handleHarmonyChange: function(e) {
25-
this.setState({harmony: e.target.checked});
26-
},
27-
render: function() {
28-
return (
29-
<div>
30-
<ReactPlayground
31-
codeText={HELLO_COMPONENT}
32-
renderCode={true}
33-
transformer={transformer.bind(null, this.state.harmony)}
34-
showCompiledJSTab={false}
35-
/>
36-
<label className="compiler-option">
37-
<input
38-
type="checkbox"
39-
onChange={this.handleHarmonyChange}
40-
checked={this.state.harmony} />{' '}
41-
Enable ES6 transforms (<code>--harmony</code>)
42-
</label>
43-
</div>
44-
);
45-
},
46-
});
4719
React.renderComponent(
48-
<CompilerPlayground />,
20+
<ReactPlayground
21+
codeText={HELLO_COMPONENT}
22+
renderCode={true}
23+
transformer={transformer}
24+
showCompiledJSTab={false}
25+
/>,
4926
document.getElementById('jsxCompiler')
5027
);

docs/_js/live_editor.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,10 @@ var ReactPlayground = React.createClass({
173173
this.executeCode();
174174
},
175175

176-
componentDidUpdate: function(prevProps, prevState) {
176+
componentWillUpdate: function(nextProps, nextState) {
177177
// execute code only when the state's not being updated by switching tab
178178
// this avoids re-displaying the error, which comes after a certain delay
179-
if (this.props.transformer !== prevProps.transformer ||
180-
this.state.code !== prevState.code) {
179+
if (this.state.code !== nextState.code) {
181180
this.executeCode();
182181
}
183182
},

0 commit comments

Comments
 (0)