mirror of
https://github.com/facebook/react.git
synced 2026-02-24 20:53:03 +00:00
* Add react-dom-unstable-native-dependencies react-native-web and react-primitives currently access a few internals for shimming DOM events into native ones. Changes in react@16 packaging hide these internals completely. This change adds a submodule to react-dom, unstable-native-dependencies that includes the necessary modules to continue enabling that method of dom-native event injection. * Update ResponderEventPlugin to use "public" interfaces for test In order to get some sort of smoke testing on react-dom-unstable-native-dependencies, update ResponderEventPlugin-test to use the "public" interfaces provided by react-dom and the new react-dom/unstable-native dependencies Also adds the missing references in package.json as well as missing files required for unittests to do imports correctrly Also exports injectComponentTree() which is required for the unittests to re-set the shared component state between runs. * Tweak bundle comment * Bundle content updates from exporting injectComponentTree * Added FB_DEV, FB_PROD to bundle types * Run yarn prettier for -unstable-native-dependencies updates
react-dom
This package serves as the entry point of the DOM-related rendering paths. It is intended to be paired with the isomorphic React, which will be shipped as react to npm.
Installation
npm install react react-dom
Usage
In the browser
var React = require('react');
var ReactDOM = require('react-dom');
class MyComponent extends React.Component {
render() {
return <div>Hello World</div>;
}
}
ReactDOM.render(<MyComponent />, node);
On the server
var React = require('react');
var ReactDOMServer = require('react-dom/server');
class MyComponent extends React.Component {
render() {
return <div>Hello World</div>;
}
}
ReactDOMServer.renderToString(<MyComponent />);
API
react-dom
findDOMNoderenderunmountComponentAtNode
react-dom/server
renderToStringrenderToStaticMarkup