I have an input field and When we enter the value in the input field I am updating the state with the entered value using event.target.value. By default the event.target.value be a string. Can we convert that into an integer ?
//useState()
const [count,setCount]=useState();
//handler function
const handleCapacity=(e)=>{
setCount(e.target.value);
}
//form code
<select value={count} onChange={handleCapacity}>
<option value="one">1</option>
<option value="two">2</option>
<option value="three">3</option>
</select>
output
If I print count value iam getting String values for example 1==>"one" 2==>"two" 3==>"three" How to get integer values?