Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
Browser page doesn't auto-refreshes in react project

import React from "react";
import "./App.css";

function SecretComponent() {
  return <p>Secret2 information for authorised users only </p>;
}

function RegularComponent() {
  return <p>Everyone1 can see this component</p>;
}

function App(props) {
  if (props.authorized) {
    return <SecretComponent />;
  } else {
    return <RegularComponent />;
  }
}

import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";

ReactDOM.render(<App authorized={false} />, document.getElementById("root"));

In my react project in Visual Studio Code when I make a change the browser page refreshes only if a change is made in the App.js file but doesn't refresh when a change is made in the index.js file. I have to refresh the page manually to show the change.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this:

  1. npm install react-hot-loader

  2. In app.js , add import { hot } from 'react-hot-loader/root' .

  3. Wrap the App component while exporting export default hot(App) like this.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda