Upgrade from React 17 to React 19#15
Conversation
- Update react and react-dom from ^17.0.2 to ^19.0.0 - Update react-icons from ^4.3.1 to ^5.4.0 - Update @testing-library/react from ^12.1.4 to ^16.1.0 - Migrate ReactDOM.render() to createRoot API in src/index.js - Add nodeRef to CSSTransition in Alert and Modal to avoid findDOMNode (removed in React 19) - Fix App.test.jsx to wrap App in AlertProvider and test for actual content Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Testing Results — React 19 UpgradeAll 8 tests passed. Ran the app locally on React 19, testing all migrated components end-to-end via browser UI. Core Migration Tests
|
Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
| "react-icons": "^4.3.1", | ||
| "react-dom": "^19.0.0", | ||
| "react-icons": "^5.4.0", | ||
| "react-scripts": "5.0.0", |
There was a problem hiding this comment.
🚩 react-scripts 5.0.0 may have compatibility issues with React 19
The PR upgrades to react@^19.0.0 and react-dom@^19.0.0 but keeps react-scripts at 5.0.0. CRA's react-scripts@5 was designed for React 17/18 and may have peer dependency warnings or subtle incompatibilities with React 19 (e.g., internal webpack/babel plugin assumptions). This likely works in practice but could cause issues with certain CRA internals or dev tooling.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Acknowledged — this is a known tradeoff. react-scripts@5.0.1 is the latest release (Feb 2022), and CRA is effectively unmaintained, so there's no React 19-compatible version to upgrade to.
In practice, everything works:
npm installresolves with automatic peer dependency overrides (no--legacy-peer-depsneeded)npm run buildcompiles successfullynpm startdev server runs without issuesCI=true npm testpasses- End-to-end UI testing confirmed no runtime issues
A full migration to Vite would eliminate this concern entirely but is a larger effort beyond the scope of this React version upgrade. If the team wants to pursue that as a follow-up, it would be a clean next step.
Summary
Upgrades the project from React 17.0.2 to React 19.0.0, including all necessary API migrations and dependency updates.
Dependency updates (
package.json)react:^17.0.2→^19.0.0react-dom:^17.0.2→^19.0.0react-icons:^4.3.1→^5.4.0@testing-library/react:^12.1.4→^16.1.0(React 19 compatible)react-transition-group:^4.4.2→^4.4.5(latest)react-countdown(^2.3.2),react-scripts(5.0.0) — kept at current versions (compatible with React 19)API migrations
src/index.js: Migrated fromReactDOM.render()tocreateRoot()API (react-dom/client)src/components/Alert/Alert.jsx: AddednodeRefprop toCSSTransitionto avoidfindDOMNode(removed in React 19)src/components/Modal/Modal.jsx: Added separatecontainerRefforCSSTransitionnodeRef, keepingmodalRefforuseOnClickOutsidebehaviorTest fix
src/App.test.jsx: Fixed pre-existing broken test — wrapped<App>inAlertProvidercontext and updated assertion to check for actual WORDLE heading instead of non-existent "learn react" textVerification
npm run build) compiles successfullyReview & Testing Checklist for Human
npm startand verify the game plays correctly (type guesses, submit, check color feedback)Notes
defaultProps, noforwardRef, no string refs, no legacy lifecycle methods)react-scripts(CRA) build tooling still works with React 19 via automatic peer dependency resolutionreact-transition-groupstill referencesfindDOMNodeinternally (even in 4.4.5), but thenodeRefprop we added to allCSSTransitionusages ensures thefindDOMNodecode path is never executed@types/reactand@types/react-domare not direct dependencies (project is JavaScript, not TypeScript) — they exist only as transitive deps through react-scriptsLink to Devin session: https://app.devin.ai/sessions/b1bf6b92ac1a42c3b524afa95e7a8cf6
Requested by: @shahmir-masood
Devin Review