I need to call a function when a child element of the date picker is clicked
<DropdownParent > <DatePicker selectsStart showYearDropdown showMonthDropdown endDate={endDate} selected={startDate} scrollableYearDropdown dateFormat="dd/MM/yyyy" startDate={startDate} yearDropdownItemNumber={10} onChange={(date) => handleChange({ startDateObj: date })} placeholderText={placeholderStart} inline locale="en-gb" /> </DropdownDefaultAtom>
There is a toggle function in DropdownParent, I need to call it when the child function handleChange is called, I tried callbacks and other methods, but since it is a library, I don't know how to detect the change and pass it to the parent component to call the parent function.
P粉4706452222023-09-11 18:20:04
Update the value in Redux, then use it in the change detection of the child component after the value has been updated in Redux, and you can use it throughout the application.