I have this Field that renders an Input component RenderInput. I need to pass a default value to it, something like value="100".
<Field
name="hours"
type="number"
placeholder="Ingrese las horas para esta categoría"
component={RenderInput}
onChange={(event) => {
handleSubmit(currentValues => this.debounceSubmitProduction({
...currentValues,
hours: event.target.value,
}))();
}}
/>
This is the RenderInput component:
const RenderInput = ({
input,
type,
disabled,
readOnly,
placeholder,
meta: { touched, error },
onKeyDown,
innerRef,
}) => (
<div>
<input
{...input}
type={type}
disabled={disabled}
readOnly={readOnly}
placeholder={placeholder}
className={`font-300 ${touched && error && 'has-error'}`}
onKeyDown={onKeyDown}
ref={innerRef}
/>
</div>
);
If I put value="100" inside the RenderInput component, it works fine, but If I try to pass that value as a props to the RenderInput component, it doesn't work. How can I pass the property value from <Field /> to RenderInput?