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

321
Views
Seleccionar etiqueta, opción de configuración sobre un cierto valor máximo

Estoy tratando de agregar una opción a mi elemento de selección para poder elegir una opción máxima sobre un valor determinado. En este caso, 250. He intentado hacer el operador de comparación mayor que ">" > 250, pero no parece aceptar esa sintaxis. ¿Cómo sería posible hacerlo al máximo?

 import { useState } from "react"; import "./styles.css"; export default function App() { const [minPrice, setMinPrice] = useState(0); const [maxPrice, setMaxPrice] = useState(50); const handlePrice = (value) => { switch (value) { case "1": setMinPrice(0); setMaxPrice(50); break; case "2": setMinPrice(50); setMaxPrice(100); break; case "3": setMinPrice(100); setMaxPrice(250); break; case "4": setMinPrice(250); setMaxPrice(>250); //doesn't work break; default: setMinPrice(0); setMaxPrice(50); break; } }; return ( <div className="App"> <select className="custom-select" id="priceGroup" onChange={(event) => handlePrice(event.target.value)} > <option value="1">Under $50</option> <option value="2">$50 to $100</option> <option value="3">$100 to $250</option> <option value="4">Over $250</option> </select> <div>Your min price is {minPrice}</div> <div>Your max price is {maxPrice}</div> </div> ); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo que puedo entender de la pregunta es que desea mostrar "> 250" cuando el usuario selecciona la opción 4. Si es así, setMaxPrice(>250) no funcionará porque >250 no pertenece a ningún tipo de datos. Podría pasarlo como una cadena como setMaxPrice(">250") y eso debería funcionar.

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!