const startDateRef = useRef();
const dateFilter = (event) => {
startDateRef.current.value = "";
}
<Form.Group controlId="dob" ref={startDateRef}>
<Form.Label>Start Date</Form.Label>
<Form.Control
ref={startDateRef}
type="date"
name="stDate"
value={dateBetweenState.stDate}
placeholder="Date of Birth"
onChange={(e) => {
handleChange(e);
}}
/>
<select
type="text"
className="form-select"
name="stDate"
onChange={(e) => {
dateFilter(e.target.value);
}}
>
<option value={0}>Choose...</option>
<option value={7}>7 Days</option>
<option value={14}>14 Days</option>
<option value={30}>30 Days</option>
</select>
...
This is my code segment. I just typed here relevant code only. actual code too long . Anyway here have date-picker and select-box . If picked date and then select item from selection box. I need to clear early picked data from data-picker . I just tried it from react ref . I did that from when select item onChange function work and it contains the ref assigns the value to clear. but it does not work.