react/packages/react-dom
Brian Vaughn 895ae67fd3
Improve error boundary handling for unmounted subtrees (#20645)
A passive effect's cleanup function may throw after an unmount. Prior to this commit, such an error would be ignored. (React would not notify any error boundaries.)

After this commit, React will skip any unmounted boundaries and look for a still-mounted boundary. If one is found, it will call getDerivedStateFromError and/or componentDidCatch (depending on the type of boundary). Unmounted boundaries will be ignored, but as they have been unmounted– this seems appropriate.
2021-01-25 08:54:20 -05:00
..
npm ReactDOM: remove unstable-native-dependencies bundle (#18483) 2020-04-18 15:40:13 -07:00
src Improve error boundary handling for unmounted subtrees (#20645) 2021-01-25 08:54:20 -05:00
README.md Tweak react-dom README 2018-09-06 15:22:10 +01:00
index.classic.fb.js Decouple update priority tracking from Scheduler package (#19121) 2020-07-06 18:53:42 -04:00
index.experimental.js Decouple update priority tracking from Scheduler package (#19121) 2020-07-06 18:53:42 -04:00
index.js Decouple update priority tracking from Scheduler package (#19121) 2020-07-06 18:53:42 -04:00
index.modern.fb.js Decouple update priority tracking from Scheduler package (#19121) 2020-07-06 18:53:42 -04:00
index.stable.js Rename 17 to 18 in warnings (#19031) 2020-05-28 10:25:39 -07:00
package.json Fixed invalid DevTools work tags (#20362) 2020-12-01 10:33:32 -05:00
server.browser.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
server.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
server.node.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
test-utils.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
testing.classic.fb.js Experimental test selector API (#18607) 2020-05-05 10:37:46 -07:00
testing.experimental.js Refactor Host Config Infra (getting rid of .inline*.js) (#18240) 2020-03-06 16:20:42 -08:00
testing.js Experimental test selector API (#18607) 2020-05-05 10:37:46 -07:00
testing.modern.fb.js Experimental test selector API (#18607) 2020-05-05 10:37:46 -07:00
testing.stable.js Refactor Host Config Infra (getting rid of .inline*.js) (#18240) 2020-03-06 16:20:42 -08:00
unstable-fizz.browser.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
unstable-fizz.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00
unstable-fizz.node.js Convert the rest of react-dom and react-test-renderer to Named Exports (#18145) 2020-02-26 18:04:32 -08:00

README.md

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');

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

  • findDOMNode
  • render
  • unmountComponentAtNode

react-dom/server

  • renderToString
  • renderToStaticMarkup