admin管理员组文章数量:1334691
Hi I am working through the React.js tutorials and I ran into a snag. When using React it works fine with the jsx transformer on my page. Once I remove that script and pile the jsx to js it no longer works. I'm using the jsx piler that React remends on their page. Here's my code:
jsFiddle
<div id="content"></div>
<script src=".13.1.js"></script>
<script type="text/jsx">
var CommentBox = React.createClass({displayName: "CommentBox",
render: function() {
return (
React.createElement("div", {className: "mentBox"},
"Hello, world! I am a CommentBox."
)
);
}
});
React.render(
React.createElement(CommentBox, null),
document.getElementById('content')
);
</script>
Thanks for the help!
Hi I am working through the React.js tutorials and I ran into a snag. When using React it works fine with the jsx transformer on my page. Once I remove that script and pile the jsx to js it no longer works. I'm using the jsx piler that React remends on their page. Here's my code:
jsFiddle
<div id="content"></div>
<script src="https://fb.me/react-0.13.1.js"></script>
<script type="text/jsx">
var CommentBox = React.createClass({displayName: "CommentBox",
render: function() {
return (
React.createElement("div", {className: "mentBox"},
"Hello, world! I am a CommentBox."
)
);
}
});
React.render(
React.createElement(CommentBox, null),
document.getElementById('content')
);
</script>
Thanks for the help!
Share Improve this question edited Jan 30, 2016 at 10:25 Dmitry Shvedov 3,3064 gold badges40 silver badges56 bronze badges asked Mar 26, 2015 at 14:14 MunkMunk 1531 silver badge7 bronze badges 01 Answer
Reset to default 10<script type="text/jsx">
If you don’t use JSX, you should remove that type. Then it will work as expected. (Fiddle)
本文标签: javascriptPrecompiled JSX Reactjs is not workingStack Overflow
版权声明:本文标题:javascript - Precompiled JSX React,js is not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742243281a2438968.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论