Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

react-dom

Package Overview
Dependencies
2
Maintainers
8
Versions
955
Issues
File Explorer

Advanced tools

react-dom

React package for working with the DOM.

    18.2.0latest

Version published
Maintainers
8
Weekly downloads
14,122,443
decreased by-2.75%

Weekly downloads

Changelog

Source

18.2.0 (June 14, 2022)

React DOM

  • Provide a component stack as a second argument to onRecoverableError. (@gnoff in #24591)
  • Fix hydrating into document causing a blank page on mismatch. (@gnoff in #24523)
  • Fix false positive hydration errors with Suspense. (@gnoff in #24480 and @acdlite in #24532)
  • Fix ignored setState in Safari when adding an iframe. (@gaearon in #24459)

React DOM Server

  • Pass information about server errors to the client. (@salazarm and @gnoff in #24551 and #24591)
  • Allow to provide a reason when aborting the HTML stream. (@gnoff in #24680)
  • Eliminate extraneous text separators in the HTML where possible. (@gnoff in #24630)
  • Disallow complex children inside <title> elements to match the browser constraints. (@gnoff in #24679)
  • Fix buffering in some worker environments by explicitly setting highWaterMark to 0. (@jplhomer in #24641)

Server Components (Experimental)

  • Add support for useId() inside Server Components. (@gnoff) in #24172

Readme

Source

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

import { createRoot } from 'react-dom/client'; function App() { return <div>Hello World</div>; } const root = createRoot(document.getElementById('root')); root.render(<App />);

On the server

import { renderToPipeableStream } from 'react-dom/server'; function App() { return <div>Hello World</div>; } function handleRequest(res) { // ... in your server handler ... const stream = renderToPipeableStream(<App />, { onShellReady() { res.statusCode = 200; res.setHeader('Content-type', 'text/html'); stream.pipe(res); }, // ... }); }

API

react-dom

See https://reactjs.org/docs/react-dom.html

react-dom/client

See https://reactjs.org/docs/react-dom-client.html

react-dom/server

See https://reactjs.org/docs/react-dom-server.html

Keywords

FAQs

What is react-dom?

React package for working with the DOM.

Is react-dom popular?

The npm package react-dom receives a total of 11,226,522 weekly downloads. As such, react-dom popularity was classified as popular.

Is react-dom well maintained?

We found that react-dom demonstrated a healthy version release cadence and project activity. It has 8 open source maintainers collaborating on the project.

Last updated on 14 Jun 2022
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc