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

162
Views
If there is a notification, a warning sign appears on the notification icon

Notification list is coming from the backend. It returns a boolean value and notification list from this list. Boolean value name is 'newNotification'. If the 'newNotification' value is false, I don't want to show the warning sign on the icon.

response screenshot (I know it's a bad show)

enter image description here

js

<div className="header__notification">
 <AS.Badge 
   color="primary"
   variant="dot"
   onClick={handleNotificationClick}
   className={notificationData.newNotification === false ? 'hidden' : 'header__notification'}
 >
   <AS.NotificationsOutlinedIcon className="header__notification_icon" />
 </AS.Badge>
</div>

css

.header__notification {
  .MuiBadge-root {
    .MuiBadge-badge {
      background-color: var(--palette-blue-300) !important;
      top: 8px !important;
      right: 7px !important;
    }
  }

  .hidden {
    display: none;
  }
}

I tried to come up with such a solution. But I am getting an error like this;

Uncaught TypeError: Cannot read properties of undefined (reading 'newNotification')

How can I do it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

can you please change className={notificationData.newNotification === false ? 'hidden' : 'header__notification'} to className={!notificationData?.newNotification ? 'hidden' : 'header__notification'}, try this, I hope this works.

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