流星+反应+反应引导程序组合所需的软件包 [英] Required Package in combination meteor+react+react-bootstrap
问题描述
我单独使用以下组合包
$ meteor add react
$ meteor add firfi:meteor-react-bootstrap
当我使用react
软件包时,引导程序无法正常工作.
When I used the react
package, bootstrap is not working.
如果我使用firfi:meteor-react-bootstrap
,则React包不起作用.
If I use firfi:meteor-react-bootstrap
, the react package is not working.
当我同时使用两个软件包时,都会出现错误
When I used both packages there is an error
未捕获的错误:永久违反:addComponentAsRefTo(...):只有ReactOwner可以具有引用.这通常意味着您正在尝试向没有所有者的组件(即不是在另一个组件的
render
方法内部创建的组件)添加引用.尝试将该组件渲染到一个新的顶级组件中,该顶级组件将保存引用.
Uncaught 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.
任何人都可以为流星建议一个用于 react 和 react-bootstrap 的软件包吗?
Can anyone suggest a package for react and react-bootstrap for meteor?
我的代码:
var { Modal,Button,Input} = ReactBootstrap;
if (Meteor.isClient){
Meteor.startup(function () {
console.log("METEOR STARTUP");
React.render(<MyModal/>, document.getElementById('modal-container'));
});
}
var MyModal = React.createClass({
render: function() {
return (
<div className="modal-open">
<Modal
title='Modeltest'
backdrop={true}
animation={false}
closeButton={true}
onRequestHide={() => {}}>
<div className='modal-body'>
<p>Check the Modal body</p>
</div>
</Modal>
</div>
)
}
});
推荐答案
我尝试了几种选择,而今天对我来说最合适的设置是:
I have tried a few alternatives, and the set that works best for me today is:
react 0.1.13 Everything you need to use React with Meteor.
twbs:bootstrap 3.3.5 The most popular front-end framework for developing responsive, mobile first projects on the web.
universe:react-bootstrap 0.24.0 ReactBootstrap project wrapped for Meteor with Universe:modules
0.24版本今天有点旧了,但是无论如何您都不能使用最新的React-Bootstrap,因为它需要Meteor尚未升级到的React 0.14. (请参阅流星问题#116 )
Version 0.24 is a bit old today, but you cannot use the latest React-Bootstrap anyway, since it requires React 0.14 which Meteor has not yet upgraded to. (See Meteor issue #116)
这篇关于流星+反应+反应引导程序组合所需的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!