how to fix such an error onSubmit
is a function and should work as one if its not it will throw another error i double checked my code i tried binding this to it but still and there is a warning on formValues
that its not used. so here's the code :
import React from "react";
import { Field, formValues, reduxForm } from "redux-form";
import { connect } from "react-redux";
import { createStream } from "../../actions";
class StreamCreate extends React.Component {
renderError({ error, touched }) {
if (touched && error) {
return (
<div className="ui error message">
<div className="header">{error}</div>
</div>
);
}
}
onSubmit = (formValues) => {
this.props.createStream(formValues);
};
render() {
return (
<form
className="ui form error"
onSubmit={this.props.handleSubmit(this.onSubmit)}
>
<Field name="title" component={this.renderInput} label="Enter title" />
<Field
name="description"
component={this.renderInput}
label="Enter description"
/>
<button className="ui button primary">submit</button>
</form>
);
}
}
const formWrapped = reduxForm({ form: "streamCreate", validate: validate })(
StreamCreate
);
export default connect(null, createStream)(formWrapped);
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment