Skip to content

Replace ReactDOM.render with createRoot in React padding example#1192

Open
nikhilsdabhade wants to merge 1 commit into
TanStack:mainfrom
nikhilsdabhade:fix/replace-reactdom-render-with-createroot
Open

Replace ReactDOM.render with createRoot in React padding example#1192
nikhilsdabhade wants to merge 1 commit into
TanStack:mainfrom
nikhilsdabhade:fix/replace-reactdom-render-with-createroot

Conversation

@nikhilsdabhade

@nikhilsdabhade nikhilsdabhade commented Jun 10, 2026

Copy link
Copy Markdown

Replaced ReactDOM.render with createRoot in React padding example as the example was not even showing any preview in the docs.

Related to #1190

Summary by CodeRabbit

  • Chores
    • Updated React initialization to use the latest API.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The example app in examples/react/padding/src/main.tsx is updated from React 17 legacy API to React 18 standard API. The react-dom import becomes react-dom/client, and ReactDOM.render() is replaced with createRoot() initialization followed by root.render().

Changes

React 18 Root API Adoption

Layer / File(s) Summary
React 18 root API adoption
examples/react/padding/src/main.tsx
Import updated to react-dom/client. Root initialization and rendering replaced with createRoot() and root.render() while preserving React.StrictMode wrapper.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 One file, one sprint—React's old way goes bye,
Root API blooms where render used to lie,
createRoot takes the stage, clean and bright,
StrictMode still stands guard through the night! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description lacks required sections from the template, including the detailed changes section, checklist completion, and release impact assessment. Add the missing template sections: expand the Changes section with detailed explanation, complete the Checklist items, and specify the Release Impact (either document the changeset or mark as docs/dev-only).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing the legacy ReactDOM.render API with the React 18 createRoot API in the React padding example.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant