Required Package in combination meteor+react+react-bootstrap

ぐ巨炮叔叔 提交于 2019-12-10 12:10:40

问题


I used the following packages individually and combined

$ meteor add react
$ meteor add firfi:meteor-react-bootstrap

When I used the react package, bootstrap is not working.

If I use firfi:meteor-react-bootstrap, the react package is not working.

When I used both packages there is an error

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.

Can anyone suggest a package for react and react-bootstrap for meteor?

My Code:

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>
        )
    }
});

回答1:


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

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)



来源:https://stackoverflow.com/questions/33047361/required-package-in-combination-meteorreactreact-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!