Cách viết mã này mà không cần sử dụng JSX?cách kết xuất nhiều trẻ em mà không cần JSX
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
<h1>Comments</h1>
<CommentList />
<CommentForm />
</div>
);
}
});
này xuất phát từ react.js hướng dẫn: http://facebook.github.io/react/docs/tutorial.html
Tôi biết tôi có thể làm như sau:
return (
React.createElement('div', { className: "commentBox" },
React.createElement('h1', {}, "Comments")
)
Nhưng điều này chỉ hỗ trợ thêm một phần tử. Làm thế nào tôi có thể thêm nhiều hơn bên cạnh nhau.
JSX Compiler dường như bị phản đối. Sử dụng https://babeljs.io/repl/ thay vì –