I try get a value of my option/select for use it in states in future, but when I try get element by ID, i got error "Cannot read property 'value' of null"
import React from "react";
function Inputs() {
const Period = document.getElementById("Period");
console.log(Period);
const inputHandler = (inputName) => {
console.log(inputName.value);
};
return (
<div>
<label>Period:</label>
<select id="Period" onChange={() => inputHandler(Period)}>
<option>Last 12 month</option>
<option>Last 6 month</option>
<option>Last month</option>
</select>
</div>
);
}
export default Inputs;