mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
d47339ea36
* Remove pushEmpty This is only used to support the assignID mechanism. * Remove assignID mechanism This effectively isn't used anyway because we always insert a dummy tag into the fallback. * Emit the template tag with an ID directly in pending boundaries This ensures that assigning the ID is deterministic since it's done during writing. This also avoids emitting it for client rendered boundaries that start as client rendered since we never need to refer to them. * Move lazy ID initialization to the core implementation We never need an ID before we write a pending boundary. This also ensures that ID generation is deterministic by moving it to the write phase. * Simplify the inserted scripts We can assume that there are no text nodes before the template tag so this simplifies the script that finds the comment node. It should be the direct previous child.
react-dom
This package serves as the entry point to the DOM and server renderers for React. It is intended to be paired with the generic React package, which is shipped as react to npm.
Installation
npm install react react-dom
Usage
In the browser
var React = require('react');
var ReactDOM = require('react-dom');
function MyComponent() {
return <div>Hello World</div>;
}
ReactDOM.render(<MyComponent />, node);
On the server
var React = require('react');
var ReactDOMServer = require('react-dom/server');
function MyComponent() {
return <div>Hello World</div>;
}
ReactDOMServer.renderToString(<MyComponent />);
API
react-dom
findDOMNoderenderunmountComponentAtNode
react-dom/server
renderToStringrenderToStaticMarkup