Home › How to fix › Versions
VER003Guided fixReact version does not match SPFx
Why it matters
Each SPFx version supports exactly one React version (SPFx 1.24 → React 18.3.1). A mismatch can fail silently at runtime.
How to fix
- npm install react@<version> react-dom@<version> --save-exact
- For React 18: switch ReactDom.render to createRoot(...).render() and unmountComponentAtNode to root.unmount().
- Update @types/react and @types/react-dom to the same major.
Microsoft articles
- SPFx compatibility reference (Node, React, TypeScript)learn.microsoft.com
- Upgrade to React 18 (SPFx 1.24)learn.microsoft.com
In VS Code: right-click the finding → Apply Fix…, or use ▶ Fix step by step in the report.