Bootstrap modal in React.js

前端 未结 12 1398
别跟我提以往
别跟我提以往 2020-12-02 07:19

I need to open a Bootstrap Modal from clicking on a button in a Bootstrap navbar and other places (to show data for a component instance, ie. providing \"editing\" f

12条回答
  •  情书的邮戳
    2020-12-02 08:10

    I Created this function:

    onAddListItem: function () {
        var Modal = ReactBootstrap.Modal;
        React.render((
            
                
    • Cras justo odio
    • Dapibus ac facilisis in
    • Morbi leo risus
    • Porta ac consectetur ac
    • Vestibulum at eros
    ), document.querySelector('#modal-wrapper')); }

    And then used it on my Button trigger.

    To 'hide' the Modal:

    hideListItem: function () {
        React.unmountComponentAtNode(document.querySelector('#modal-wrapper'));
    },
    

提交回复
热议问题