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

173
Vistas
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 Respuestas
Responde la pregunta

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 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