Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

86
Vistas
what is difference Three-way operator( ~ ? a: b). and Alternative operator. in my code
<>
   {isLoading || <Loader />}
   <iframe
     ref={iframeRef}
     title="title"
     src={src}
     onLoad={onIframeLoad}
   />
</>

I wrote the code like this at first. this code is in react and with
const [isLoading, setIsLoading] = useState(true) and In the onIframeLoad func With other works, i doing setIsLoading(false)

so i think loader component i cant see but i can see iframe with loader ???

so i changed the code {isLoading || } => {isLoading ? : ''} then it work well

but i dont understand what is difference code meaning

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

<Loader /> component will be visible when isLoading is false in your code.

{isLoading || <Loader />} should be {isLoading && <Loader />}.

<>
   {isLoading && <Loader />}
   <iframe
     ref={iframeRef}
     title="title"
     src={src}
     onLoad={onIframeLoad}
   />
</>
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos