A dev server helps you see your app changes instantly. Hot Module Replacement (HMR) updates parts of your app without a full reload, saving time and keeping your work smooth.
Dev server and hot module replacement in Remix
npm run dev
This command starts the Remix development server with HMR enabled by default.
You do not need extra setup for HMR in Remix; it works out of the box.
npm run dev
remix dev
This simple counter component shows how HMR keeps the state (count) while updating the UI instantly when you change code.
import { useState } from 'react'; export default function Counter() { const [count, setCount] = useState(0); return ( <main> <h1>Counter: {count}</h1> <button onClick={() => setCount(count + 1)}>Increase</button> </main> ); } // Run 'npm run dev' to start the dev server with HMR. // Change the button text or style and save. // The page updates instantly without losing the count value.
HMR only updates changed modules, so your app stays fast and responsive.
If you see the full page reload, check your Remix version or dev server setup.
Use browser DevTools console to see HMR logs and errors.
Dev server shows your app live as you code.
Hot Module Replacement updates parts of your app without full reload.
Remix enables HMR automatically for a smooth development experience.
Practice
Solution
Step 1: Understand the role of a dev server
The dev server runs your app locally and shows changes immediately as you code.Step 2: Identify Remix dev server behavior
Remix dev server provides live updates so you can see your app without manual reloads.Final Answer:
To show your app live and update it as you code -> Option AQuick Check:
Dev server = live app updates [OK]
- Confusing dev server with production build process
- Thinking dev server deploys app
- Assuming dev server manages database
Solution
Step 1: Identify Remix commands
"remix dev" runs the development server with live reload and HMR.Step 2: Differentiate other commands
"remix build" creates production files, "remix start" runs production server, "remix deploy" is not a standard command.Final Answer:
remix dev -> Option CQuick Check:
Dev server command = remix dev [OK]
- Using 'remix build' instead of 'remix dev'
- Confusing 'remix start' with dev server
- Assuming 'remix deploy' exists
<h1> tag while running the dev server?
export default function Home() {
return <h1>Hello Remix!</h1>
}Solution
Step 1: Understand Hot Module Replacement (HMR)
HMR updates changed parts of the app instantly without full reload.Step 2: Apply HMR to text change in component
Changing the <h1> text triggers HMR, so the text updates immediately.Final Answer:
The text updates instantly without full page reload -> Option AQuick Check:
Text change triggers HMR update [OK]
- Thinking full page reload happens on every change
- Assuming dev server crashes on code edit
- Believing restart is needed for changes
Solution
Step 1: Identify symptoms of no auto update
If browser doesn't update automatically, HMR is likely not working.Step 2: Check Remix dev server mode
Dev server in production mode disables HMR, but Remix dev server runs in dev mode by default.Final Answer:
Hot Module Replacement is disabled or not working -> Option BQuick Check:
No auto update = HMR issue [OK]
- Assuming file save is unrelated
- Confusing production mode with dev server
- Thinking browser cache disables updates
Solution
Step 1: Understand Remix HMR for CSS
Remix supports HMR for CSS when imported in JS/TS files.Step 2: Identify correct CSS usage
Importing CSS in component enables HMR; linking manually or placing in public folder bypasses HMR.Final Answer:
Import the CSS file directly in your component file -> Option DQuick Check:
CSS import in component enables HMR [OK]
- Linking CSS in HTML disables HMR
- Placing CSS in public folder skips HMR
- Restarting dev server is unnecessary
Ready to prove it?
Pass the test and this pattern moves unknown
