React-refresh/only-export-components
lastmod 2025-12-23created 2025-12-231 edits
react-refresh works more cleverly than "hot reloading". Fast Refresh tries to re-run only components and preserve state. For this, a file must "export only components, no exceptions".
React Refresh fails to detect components, or detects them wrongly, and state is not preserved after a refresh.
Just keep non-component things in separate files.