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

163
Views
Si hay una notificación, aparece una señal de advertencia en el icono de notificación

La lista de notificaciones proviene del backend. Devuelve un valor booleano y una lista de notificaciones de esta lista. El nombre del valor booleano es 'newNotification'. Si el valor de 'newNotification' es falso, no quiero mostrar la señal de advertencia en el icono.

captura de pantalla de respuesta (sé que es un mal espectáculo)

ingrese la descripción de la imagen aquí

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

Traté de llegar a una solución de este tipo. Pero recibo un error como este;

TypeError no capturado: no se pueden leer las propiedades de undefined (leyendo 'newNotification')

¿Cómo puedo hacerlo?

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

0

¿Puede cambiar className={notificationData.newNotification === false ? 'hidden' : 'header__notification'} to className={!notificationData?.newNotification ? 'hidden' : 'header__notification'} , intente esto, espero que esto funcione.

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!