Projekt

Obecné

Profil

Stáhnout (904 Bajtů) Statistiky
| Větev: | Revize:
1
# `react-dom`
2

    
3
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.
4

    
5
## Installation
6

    
7
```sh
8
npm install react react-dom
9
```
10

    
11
## Usage
12

    
13
### In the browser
14

    
15
```js
16
var React = require('react');
17
var ReactDOM = require('react-dom');
18

    
19
class MyComponent extends React.Component {
20
  render() {
21
    return <div>Hello World</div>;
22
  }
23
}
24

    
25
ReactDOM.render(<MyComponent />, node);
26
```
27

    
28
### On the server
29

    
30
```js
31
var React = require('react');
32
var ReactDOMServer = require('react-dom/server');
33

    
34
class MyComponent extends React.Component {
35
  render() {
36
    return <div>Hello World</div>;
37
  }
38
}
39

    
40
ReactDOMServer.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`
(2-2/14)