Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!