diff --git a/packages/react-scripts/template/src/index.tsx b/packages/react-scripts/template/src/index.tsx
index a7b130622..753053e17 100644
--- a/packages/react-scripts/template/src/index.tsx
+++ b/packages/react-scripts/template/src/index.tsx
@@ -4,8 +4,25 @@ import App from './App';
import './index.css';
import registerServiceWorker from './registerServiceWorker';
-ReactDOM.render(
- ,
- document.getElementById('root') as HTMLElement
-);
+function registerHMR() {
+ type ModuleHMR = typeof module & {
+ hot?: {
+ accept(dependencies: string | string[], callback: (updatedDependencies: any[]) => void): void
+ }
+ };
+
+ if ((module as ModuleHMR).hot) {
+ (module as ModuleHMR).hot!.accept('./App', render);
+ }
+}
+
+function render() {
+ ReactDOM.render(
+ ,
+ document.getElementById('root') as HTMLElement
+ );
+}
+
registerServiceWorker();
+registerHMR();
+render();