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

239
Visualizações
How console log variables inside find method that inside a map method and return an object?

How console log variables inside find method that inside a map method and return an object ? That is an arrow function so I should use with function body and return statement. But I get error if i do.

So how can console log lbl and lbl.label inside find method?

Yes i should read how use arrow function. (this is exactly what I want to find out, among other things) Thank you

  useEffect(() => {
    setLabels((prevLabels) => {
      return [...new Set(savedEvents.map((evt) => evt.label))].map((label) => {
        const currentLabel = prevLabels.find((lbl) => lbl.label === label);

        console.log(`prevlabels: ${JSON.stringify(prevLabels)}`);
        console.log(`currentLabel: ${JSON.stringify(currentLabel)}`);
        console.log(`currentLabel.checked: ${currentLabel.checked}`);
        console.log(`label: ${label}`);
        return {
          label,
          checked: currentLabel ? currentLabel.checked : true,
        };
      });
    });
  }, [savedEvents]);
about 4 years ago · Juan Pablo Isaza
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