SPFX Pretty

Home › How to fix › Versions

VER003Guided fix

React 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

  1. npm install react@<version> react-dom@<version> --save-exact
  2. For React 18: switch ReactDom.render to createRoot(...).render() and unmountComponentAtNode to root.unmount().
  3. Update @types/react and @types/react-dom to the same major.
In VS Code: right-click the finding → Apply Fix…, or use ▶ Fix step by step in the report.