mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
9b36df86c6
* Don't call idle callback unless there's time remaining * Expiration fixture Fixture that demonstrates how async work expires after a certain interval. The fixture clogs the main thread with animation work, so it only works if the `timeout` option is provided to `requestIdleCallback`. * Pass timeout option to requestIdleCallback Forces `requestIdleCallback` to fire if too much time has elapsed, even if the main thread is busy. Required to make expiration times work properly. Otherwise, async work can expire, but React never has a chance to flush it because the browser never calls into React.
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