0
我嘗試重現下面是一個簡單的HTML代碼反應:React.js簡單的組件組成問題
經典HTML
<div>
Hello
<div>child</div>
<div>child</div>
<div>child</div>
</div>
陣營(的作品)
var HelloComponent = React.createClass(
{
render: function()
{
return (
<div>
Hello
<div>child</div>
<div>child</div>
<div>child</div>
</div>
);
}
});
var mount = React.render(<HelloComponent/>, document.body);
React(not works)
var childComponent = React.createClass(
{
render: function()
{
return (<div>child</div>);
}
});
var HelloComponent = React.createClass(
{
render: function()
{
return (
<div>
Hello
<childComponent/>
<childComponent/>
<childComponent/>
</div>
);
}
});
var mount = React.render(<HelloComponent/>, document.body);
錯誤:
Uncaught TypeError: Cannot read property 'replace' of undefined
createSourceCodeErrorMessage
transformCode
...
我怎麼會錯過?謝謝。
好的,它有多棘手。非常感謝你。 @Felix – 2015-03-25 05:20:38