UNPKG

904 BMarkdownView Raw
1# `react-dom`
2
3This 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.
4
5## Installation
6
7```sh
8npm install react react-dom
9```
10
11## Usage
12
13### In the browser
14
15```js
16var React = require('react');
17var ReactDOM = require('react-dom');
18
19class MyComponent extends React.Component {
20 render() {
21 return <div>Hello World</div>;
22 }
23}
24
25ReactDOM.render(<MyComponent />, node);
26```
27
28### On the server
29
30```js
31var React = require('react');
32var ReactDOMServer = require('react-dom/server');
33
34class MyComponent extends React.Component {
35 render() {
36 return <div>Hello World</div>;
37 }
38}
39
40ReactDOMServer.renderToString(<MyComponent />);
41```
42
43## API
44
45### `react-dom`
46
47- `findDOMNode`
48- `render`
49- `unmountComponentAtNode`
50
51### `react-dom/server`
52
53- `renderToString`
54- `renderToStaticMarkup`