Skip to content
useffect.sh
Book 30 min with a senior
Tooling

Fast Refresh

React Native’s hot reloading: a component edit is applied within a second or two while local state is preserved.

Definition

Fast Refresh is the React Native feature that applies your code edits to the running app, usually within a second or two, without restarting the app or losing component state. Enabled by default and switchable from the dev menu, it replaces the hot reloading and live reload of early versions, which were either fragile or reloaded everything. Its behavior depends on what you edit: a module that only exports React components is re-executed and its components re-rendered in place; a module with other exports also re-runs the modules importing it; a file imported outside the React tree triggers a full reload. Local state is preserved for function components and hooks, not for classes. Hooks with dependencies (useEffect, useMemo, useCallback) re-run on every refresh with their dependency lists ignored. You meet Fast Refresh on every file save, and you notice it mostly when it stops working.

In a real app

The rule that keeps Fast Refresh reliable is simple: one file, one exported component, nothing else. Constants, utility hooks, and helpers go in their own files. A component defined in a file that also exports a config object or a function loses its state on every edit, and an anonymous export default (export default () => …) prevents React from identifying it. To force a remount on every save, say on a screen whose initialization state matters, the // @refresh reset directive at the top of the file does it.

When “it stopped refreshing”, the usual causes in order: a syntax error still present (the redbox goes away once fixed), a module that threw during initialization, an edited file imported by code outside the React tree (a store created at module level, a navigation config) which forces a full reload, or a saturated Metro watcher on a large monorepo (Watchman helps on macOS).

Fast Refresh only exists in debug with Metro connected; a development build loading a published update does not have it. And it only covers JavaScript: a native change still needs a recompile.

Sources

All 35 glossary terms

One of these is blocking your app?

30 minutes with a senior to look at the problem in your code. Free.