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

109
Vistas
ReactJS : Nothing return even if the Condition is true

I am working on populating source code from GitHub. There is a condition that if source code has any problems/issues, there might or might not be a code recommendation string. The code recommendation string is usually shown just below the problems/error code, to provide the user with some code suggestions.

here is the code snippet:

--
--Some code-
---
return (
   <>
      <tr>
          -----
         --some code---
          -----
        -----
        </tr>
         {
                                                        
          (problemAtLine !== null && problemAtLine.end_lineno === curLineNum &&
             problemAtLine.recommendation && problemAtLine.recommendation.length && 
             this.props.viewModeDetails === "problems") && (
                                                                
         (problemAtLine.recommendation).forEach((recommendationStr, index) => {

          return (
             <tr key={`${"ln-cr"}-${problemAtLine.lineno + index + 1}`}>
                                                                            
            <td className="lineicon"></td>
            <td key={`ln-cr-${problemAtLine.lineno + index}`} className="linenum">
            {problemAtLine.lineno + index}</td>
            <td key={`lc-cr-${problemAtLine.lineno + index}`} className= 
 {`selcodeline-${this.props.viewModeDetails}`}>

            {(() => {
                if (index === 0) {
                    return (
                            <div className="code-recommendation-bg-selected-start"></div>
                    );
                }
                else if (index === problemAtLine.recommendation.length - 1) {
                    return (
                            <div className="code-recommendation-bg-end"></div>
                    );
                } else {
                        return (
                                <div className="code-recommendation-bg-middle"></div>
                        );
                }
        })()}
                                                                                 
            <Highlight className="python">
                                                                                     
                  {recommendationStr !== "" ? recommendationStr: " "}
            </Highlight>
        </td>

        </tr>
    )
})
)}
</>
)
                                                                

Can anyone tell me what I'm missing? Thanks in Advance

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