How to integrate react-day-picker with redux form?
I have tried:
renderDatePicker (field) {
const { meta: { touched, error } } = field;
return (
<Form.Field>
<label>{field.label}</label>
<DayPickerInput
{...field.input}
onDayChange={(day) => console.log(day)} />
{touched && error && <span>{error}</span>}
</Form.Field>
);
}
but got no luck. Seems like {...field.input} as a props. Thank you.
Problem fixed. I just put the object {...field.input} inside inputProps={{...field.input}} as inputProps is defined as Additional props to add to the input component. documentation here.
Code:
<DayPickerInput inputProps={{...field.input}} onDayChange={(day) => console.log(day)} />
Most helpful comment
Problem fixed. I just put the object
{...field.input}insideinputProps={{...field.input}}asinputPropsis defined asAdditional props to add to the input component.documentation here.Code:
<DayPickerInput inputProps={{...field.input}} onDayChange={(day) => console.log(day)} />