mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
* Add .browser and .node explicit entry points This can be useful when the automatic selection doesn't work properly. * Remove react/index I'm not sure why I added this in the first place. Perhaps due to how our builds work somehow. * Remove build-info.json from files field
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