简体   繁体   中英

Load content in Reactjs in a Modal

I'm trying to show something inside of my modal with react-bootstrap. I know you can import the component something like this:

    Modal.Dialog>
  <Modal.Header closeButton>
    <Modal.Title>Modal title</Modal.Title>
  </Modal.Header>

  <Modal.Body>
    <MyComponent/>
  </Modal.Body>

  <Modal.Footer>
    <Button variant="secondary">Close</Button>
    <Button variant="primary">Save changes</Button>
  </Modal.Footer>
</Modal.Dialog>

My doubt is if i cant do it by url with react, something like Jquery do it with .load() and instead of <MyComponent/> could be something like: $( ".ModalBody ).load( "MyComponent-url" );

I dont know if is possible do it with React, in that case this could be a bad practice? Thank you for any help!

Yes, u should avoid using jQuery anyway. Use of component way is more correct than using jQuery. Or in simple words avoid using Jquery as much as possible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM