Component method gets called for both Title and Content fields when React is initially rendered. However, while additional input change in Title field calls the renderField method, the Content field doesn't seem to do so. This is reflected in the console log where the initial component load produced 2 "input changed" and for additional changes in the title, "input change" prints, but no responses occur when changes are made to the content field. What's going on?
import React, { Component } from 'react';
import { Field, reduxForm } from 'redux-form';
class PostNew extends Component {
renderField(field) {
console.log('input changed')
return(
<div>
<label>{field.label}</label>
<input
type="text"
{...field.input}
/>
</div>
);
}
render() {
return(
<form>
<Field
label="Title"
name="title"
component={this.renderField}
/>
<Field
label="Content"
name="content"
component={this.renderField}
/>
</form>
)
}
}
export default reduxForm({
form: 'PostsNewForm' // form property is the name of the form
})(PostNew);