Review a legacy app and migration plan
Plan the change before touching dependencies
Maintenance means changing a working application without losing its useful behavior. Begin with a reproducible baseline: commit, lockfile, Node and package-manager versions, deployed configuration, known failures, tests and a rollback artifact. For a React 18 to 19 migration, the official upgrade guide suggests using the React 18.3 warning release as an intermediate diagnostic step. This is historical migration guidance, not a current security recommendation. Select an approved patched target and verify matching React/React DOM versions, framework support, peer dependency ranges, JSX transformation and any TypeScript declaration updates. Review current security advisories before executing any server integration.
// Inventory of reviewed findings, not a source-code scanner or semver resolver.export function migrationIssues(inventory) { const issues = []; if (inventory.legacyRoot) issues.push('replace legacy root'); if (inventory.reactVersion !== inventory.domVersion) issues.push('align React and React DOM'); if (inventory.peerReview !== 'PASS') issues.push('review peer constraints'); if (inventory.securityReview !== 'PASS') issues.push('review security advisories'); if (inventory.regressionTests !== 'PASS') issues.push('run regression tests'); return issues;}The function checks a small inventory provided by the reviewer. It does not inspect source, determine semver compatibility or verify security. A finding marked NOT RUN remains unresolved. Use actual package manifests, lockfile, dependency tree and advisory evidence in a real audit; do not bypass peer constraints merely to make installation succeed.
Replace removed entry points with supported ones
React 19 removed the legacy ReactDOM.render entry point. For a client-only application, create one root per host and retain it for teardown. For existing server-rendered markup use hydrateRoot instead. Do not mix the two mounting modes or create a new root on every update. The following staged source requires an HTML element with id root and reviewed React 18+ dependencies; it is not a standalone Node program.
import React, {StrictMode, useState} from 'react';import {createRoot} from 'react-dom/client';function Workshop() { const [booked, setBooked] = useState(false); return <section><p role="status">{booked ? 'Reserved' : 'Available'}</p> <button disabled={booked} onClick={() => setBooked(true)}>Reserve seat</button> </section>;}const host = document.getElementById('root');if (!host) throw new Error('Missing root container');const root = createRoot(host);root.render(<StrictMode><Workshop /></StrictMode>);export function dispose() { root.unmount(); }Expected behavior: Available appears initially; clicking Reserve seat changes the status to Reserved and disables the button. The exported dispose function unmounts the root. Development StrictMode can expose unsafe effects; fixing cleanup is preferable to treating disabled checks as evidence of a successful upgrade.
import {migrationIssues} from './migration.mjs';const findings = {legacyRoot:true, reactVersion:'18.3.1', domVersion:'18.3.1', peerReview:'NOT RUN', securityReview:'NOT RUN', regressionTests:'NOT RUN'};console.log(migrationIssues(findings));// Four outstanding issues. Versions describe a fictional old app, not an install target.The four findings identify the legacy root plus three missing reviews. An approved codemod may help with mechanical replacements, but inspect the exact tool version and every diff in a disposable branch. Run baseline and candidate tests for navigation, forms, errors, focus, subscriptions, hydration where applicable and dependency security. Keep the migration small, preserve a rollback artifact and document unresolved regressions. Do not run a remote codemod blindly. Practice: propose a release decision when the new build succeeds but keyboard behavior fails.