mc9
mc9

Reputation: 6349

Can't render react-bootstrap modal on server

I would like to know why I am unable to render react-bootstrap's modal on the server.

When I do the following on the server, I get <!-- react-empty: 1 -->:

renderToString(
  <Modal>
    <Modal.Header closeButton>
      some text
    </Modal.Header>

    <Modal.Body>
      some text
    </Modal.Body>
  </Modal>
));

It seems that <Modal> does not render anything but rather attaches a modal to the DOM using JavaScript. But I am not too sure how it works. Any suggestions on how to render a react-bootstrap's modal on server?

I also saw this issue but it seems not directly related.

Version: react-bootstrap 0.29.4, react 15.1.0, react-dom 15.1.0.

Upvotes: 0

Views: 432

Answers (1)

mc9
mc9

Reputation: 6349

It is not possible to render modal on the server side.

Got this answer from react-bootstrap member:

Rendering of shown overlays on the server is intentionally not supported.

See this issue.

Upvotes: 2

Related Questions