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

156
Vistas
React Inline Condition

I have issues setting an inline condition for my shipping price :

cart.shippingPrice =
  country === ("France" || "United States") ? toPrice(20) : toPrice(10);

Only when I select France the condition returns 20, but I want United States to return it as well, is there a typo ?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You need to explicitly check against each country:

country === "France" || country === "United States"

If you "fear" that more countries will come to the list, you could create an array:

const countries = ["France", "United States"]

and then do

countries.includes(country)
about 4 years ago · Juan Pablo Isaza Denunciar

0

In your expression and in question contents if it's returning 20 it means the condition is true.

Try:

cart.shippingPrice = (country === "France" || country === "United States) ? toPrice(20) : toPrice(10)
about 4 years ago · Juan Pablo Isaza Denunciar
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