我正在逐渐用 React 替换一些 Backbone 视图。
我的react视图:
<div id="reactViewContent">Rendered By React</div>
我需要在其他 html 元素下方呈现 React 视图而不替换它们。
<div id="somestuff">
<div id="anotherView">Other stuff not to delete</div>
<div id="placeholderForReactView"></div>
</div>
我希望我的方法可以替换占位符而不是插入它,以便:
React.render(React.createElement(MyTestReactView), document.getElementById('placeholderForReactView'));
可能导致:
<div id="somestuff">
<div>Other stuff not to delete</div>
<div id="reactViewContent">Rendered By React</div>
</div>
代替:
<div id="somestuff">
<div>Other stuff not to delete</div>
<div id="placeholderForReactView">
<div id="reactViewContent">Rendered By React</div>
</div>
</div>
如果不重复出现在 Jquery 上,是否有正确的方法来做到这一点?
