This is one of my radio buttons:
<input
type="radio"
value="0"
id="0"
name="salary"
checked={salaryRange === "0"} // Side question: is this the way to handle the active button?
onChange={() => handleChange} // Round brackets here seem unnecessary
/>;
0 - 1.0;
And this is my handleChange. Currently, it doesn't fire at all.
function handleChange(
e: React.ChangeEvent<HTMLInputElement>,
range: string
) {
console.log("changed radio button");
}
I'm not getting any TS errors. Can anyone help?
You are passing the handleChange function ref.
change onChange={() => handleChange}
to onChange={handleChange} or to onChange={(thatsMySweetEvent) => handleChange(thatsMySweetEvent)}