0
其中JSX的支持屬性是HTML標記: http://facebook.github.io/react/docs/tags-and-attributes.html陣營renderComponent需要一個DOMElement
然而,在使用時React.renderComponent,一個一個DOMElement被要求作爲一個容器。因此,在使用html標記呈現JSX時,DOMelement應該用作容器?
其中JSX的支持屬性是HTML標記: http://facebook.github.io/react/docs/tags-and-attributes.html陣營renderComponent需要一個DOMElement
然而,在使用時React.renderComponent,一個一個DOMElement被要求作爲一個容器。因此,在使用html標記呈現JSX時,DOMelement應該用作容器?
您可以使用「文檔」。
這樣的:
react.renderComponent(<App />, document);
document.documentElement中目前的工作,但使用的文檔,除非你正在使用的服務器渲染拋出一個錯誤。 – FakeRainBrigand 2014-10-01 12:39:34
是的,它應該使用「renderComponentToString」或「renderComponentStaticMarkup」在服務器上工作。 – koba04 2014-10-01 23:47:38
謝謝夥計們。我正在研究它。這兩種解決方案都無法完美運作我正在從服務器渲染,但我試圖在頁面顯示後立即在客戶端上呈現。我認爲你們都回答了我最初的問題,但恐怕我還沒有解決問題。 – Nael 2014-10-02 00:03:19