我正在使用 react-rails 和 browserify。在 application.js 我使用
// require react
// require react-ujs
我也通过使用 tcomb-form
var t=require("tcomb-form")
结果我看到 reactjs 在我的资产管道中包含了两次。
我应该如何正确使用带有 Rails 的 reactjs?
编辑:
顺便说一句,如果您在控制台中看到此错误,则可能您遇到了同样的问题,reactjs 被包含了两次。
[Error] Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's render method). Try rendering this component inside of a new top-level component which will hold the ref.