web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
904 B

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