Skip to content

HMR not reloading index.js #11603

Open
Open
@decodejacques

Description

@decodejacques

HMR generally works fine. However, when I modify my index.js file, it doesn't reload the components defined within the file. Here's how to reproduce this behaviour:

  • Create a new react app
  • replace the index.js file
import React from "react"
import ReactDOM from "react-dom"

function Foo() {
  return "first version"
}

ReactDOM.render(
  <React.StrictMode>
    <Foo />
  </React.StrictMode>,
  document.getElementById("root")
)

Load the page and you should see first version

Change the first version string to anything else. The page doesn't change since the component doesn't get reloaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions