有没有办法将 ReactJS 挂接到 backbone 中的动态元素?

Is there a way to hook ReactJS onto dynamic elements from backbone?

是否可以让 React.render() 在呈现 backbone 视图之前不被调用。因为这会生成 React.render 将挂钩的动态 DOM 元素?

有什么"beautiful"方法吗?

在视图的 render 方法中调用 React.render,并在其 remove 方法中调用 React.unmountComponentAtNode

var ReactView = Backbone.View.extend({
  render: function() {
    React.render(<MyComponent />, this.el);
    return this;
  },
  remove: function() {
    React.unmountComponentAtNode(this.el);
    Backbone.View.prototype.remove.apply(this, arguments);
  },
});

在您的情况下,您可能不会直接在 this.el 中呈现,而是 select 通过 jQuery 或 DOM API 呈现的子元素。