Home >Web Front-end >Front-end Q&A >What should I do if react does not refresh automatically?

What should I do if react does not refresh automatically?

藏色散人
藏色散人Original
2023-01-03 09:37:042801browse

Solution for react not automatically refreshing: 1. Find the directory where the "package.json" file is located; 2. Create the ".env" file in the root directory of the same level as "package.json"; 3. Just write "FAST_REFRESH=false" in the ".env" file and save it.

What should I do if react does not refresh automatically?

The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.

What should I do if react does not refresh automatically?

react project, after the modified file is saved, the page will not refresh automatically

Solution:

At the same level root of package.json Create the .env file in the directory

and write:

FAST_REFRESH=false

Done~

package.json related expansion:

Each Under the root directory of the project, there is generally a package.json file that defines the various modules required by the project, as well as the project configuration information (such as name, version, license and other metadata). The npm install command automatically downloads the required modules based on this configuration file, which is to configure the running and development environment required for the project.

The following is the simplest package.json file, which only defines two metadata: project name and project version.

 {
       "name" : "xxx",
        version" : "0.0.0",
  }

The above code illustrates that the package.json file contains a JSON object, and each member of the object is a setting of the current project. For example, name is the project name, and version is the version (following the format of "major version.minor version.minor version").

Recommended learning: "react video tutorial"

The above is the detailed content of What should I do if react does not refresh automatically?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn