Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda