Estoy tratando de obtener el tipo de número de valor de entrada. Pero el valor sigue mostrándome que es un tipo de cadena. ¿Cómo puedo solucionar esto?
const [price, setPrice] = useState();
const handlePrice = (event) => {
console.log(event.target.value);
setPrice(event.target.value);
};
<div className="col-md-6">
<label for="inputPrice" className="form-label">
Price
</label>
<input
value={price}
onChange={handlePrice}
type="number"
className="form-control"
id="inputPrice"
/>
</div>
<div className="col-12">
const handlePrice = (event) => {
console.log(event.target.value);
// setPrice(parseInt(event.target.value));
// setPrice(event.target.value * 1);
setPrice(Number(event.target.value));
};