I have a class that uses the redux-form and in my function render()
I call this:
<Field
name="type"
label = "Type Device"
component={this.renderSelect}>
<option></option>
<option name="ios">iOS</option>
<option name="android">Android</option>
</Field>
The function that is called in component
I have it in the same class:
renderInput(field) {
return(
<div>
<label>{field.label}</label>
<input
type={field.type}
placeholder={field.placeholder}
{...field.input}
/>
{field.meta.touched && field.meta.error && <span>{field.meta.error}</span>}
</div>
);
}
I want to leave it as a function in another file like this, import renderInput from './form.js';
then I print it like this console.log(this.renderInput);
but it throws me undefined
.
I did it like this:
And in my class I can use it like this
this.props.renderField