Bootstrap modal in React.js

前端 未结 12 1395
别跟我提以往
别跟我提以往 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:05

    You can try this modal:https://github.com/xue2han/react-dynamic-modal It is stateless and can be rendered only when needed.So it is very easy to use.Just like this:

        class MyModal extends Component{
           render(){
              const { text } = this.props;
              return (
                 
                    

    What you input : {text}

    ); } } class App extends Component{ openModal(){ const text = this.refs.input.value; ModalManager.open( true}/>); } render(){ return (
    ); } } ReactDOM.render(,document.getElementById('main'));

提交回复
热议问题