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

425
Vistas
React - is there any performance issue if putting the error dialog in App.js and store error in redux?

I am going to store the current error in redux store, in order to show an Error Dialog.

For the error dialog, it will store in App.js like below:

App.js

import "./styles.css";
import "bootstrap/dist/css/bootstrap.min.css";

import { useSelector } from "react-redux";

import ErrorDialog from "./ErrorDialog";
import ComponentA from "./ComponentA";

export default function App() {
  const error = useSelector((state) => state.error);
  return (
    <div className="App">
      <ComponentA />
      {Object.keys(error).length !== 0 && (
        <ErrorDialog title={error.title} message={error.message} />
      )}
    </div>
  );
}

Every Time I hit an error in any page, dispatch will be used to set the error(such as {title:"myError", message: "134"}) in redux store. The error dialog in App.js will be shown like below:
enter image description here

When I close the dialog, I will use dispatch to set the error to {} so it can be closed.

I am wondering will this lead to performance issue if there are more components? Because the <ErrorDialog/> in App.js need to be re-rendered many time.

Or will there be any better way to handle error?

about 4 years ago · Juan Pablo Isaza
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