dillon1000/react

Commit

Add warnings for common root API mistakes (#23356)

For createRoot, a common mistake is to pass JSX as the second argument,
instead of calling root.render.

For hydrateRoot, a common mistake is to forget to pass children as
the second argument.

The type system will enforce correct usage, but since not everyone uses
types we'll log a helpful warning, too.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-dom/src/__tests__/ReactDOMRoot-test.js ModifiedM packages/react-dom/src/client/ReactDOMRoot.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…