Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

427
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!