Could not Fast Refresh ⚛️ React

[vite] hmr invalidate … Could not Fast Refresh. Export is incompatible.

Fast Refresh fell back to a full reload because the file exports non-components alongside components.

Seen on: React

Meaning

Fast Refresh only works when a file exports React components. Exporting constants, hooks or context from the same file forces a reload (eslint-plugin-react-refresh warns about it).

Common causes

  • File exports a component and a constant/hook/context
  • Anonymous default export
  • Class components

⚡ Quick fix

  1. Move non-component exports to separate files
  2. Name components (export default function Card())

Detailed fix by platform

React

  1. Split UserContext and useUser into their own module next to the component

How to diagnose

  1. Exports — What else does the file export?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.