How to submit form data in React. This is a blocking error, and script execution will stop when this error occurs. this.props.onSearch (searchTerm).bind (this); I think you dont even need to bind there so. specifically the below line, handleSubmit = (data) => this.props. Look. This prop will only work if you have passed an onSubmit function that returns a promise. this.props.onSearch (searchTerm); would be enough. Finally, the entire project can be found here. Also much wrong with html tags but try replacing with this first: import React, { useState } from 'react'; class SearchBar extends React.Component { const [ term, setTerm ] = useState (''); onFormSubmit = (event) => { event.preventDefault (); props.onSubmit (term); }; This topic was . All you need to do is specify a custom function that gets called when user clicks on the submit button or press the Enter key. submitFailed : boolean Starts as false. Example: <!DOCTYPE html> <html> <head> <title> "Submit is not a function" error in JavaScript </title> </head> For example: <TodoForm onSubmit= { (description) => alert (description)} /> Read more about props in react here. Unlike other JavaScript libraries, React doesn't have any special way of handling a form submission. It's JavaScript, and functions are first-class, meaning they can be passed around like any other value. you either have to make sure you're supplying it yourself or just handle the form submit within LoginForm#handleSubmit This message indicates that our code expects to have an object with a submit function. But again I dont think you need to bind in your case since the this reference is already set properly . A subsequent successful submit will set it back to false. IMPORTANT: If onSubmit is async, then Formik will automatically set isSubmitting to false on your behalf once it has resolved. export default connect (null, mapDispatchToProps) (AddPlayer) In this case, we had a reference to a HTMLFormElement, which should have a submit function on its prototype. This means you do NOT need to call formikBag.setSubmitting(false) manually. The curly brace should be after the arrow function. Bear in mind that JSX is just dressing up a function to look like HTML If you don't have a mapStateToProps, you can just provide null as the first argument. But if the property exists, it was not a function. Share Follow francorisso commented on Oct 29, 2015 performing your submission from inside your form component by passing onSubmit= {this.props.handleSubmit (this.mySubmitFunction)} to your component AND EITHER: initiating your submission via the submit () Instance API (i.e. However, if your onSubmit function is synchronous, then you need to call setSubmitting(false) on your own. My first step would be to put a console.log ('this.props.emit', this.props.emit); on the line before it is called and find out exactly what this.props.emit is. Then I'd start working back to where it is passed in (probably a parent component or if you are using redux, then either mapDispatchToProps or even mapStateToProps ). It will be true until the promise is resolved or rejected. You have a component TodoList which calls TodoForm with the onSubmit function that it created. You need to pass the function into the <form> element's onSubmit prop: That line is simply calling this property (that was passed to it by its parent) and passing in the description ( taken from the state of TodoForm ). Create a bound method to forward the component's properties: onSubmit = (values, dispatch) => { this.props.onSubmitWithProps(values, dispatch, this.props) } Call the newly created method inside on traditional onSubmit property: this.props.handleSubmit(this.onSubmit) Pass onSubmitWithProps instead of onSubmit: handleSubmit is a prop "injected" into the Component by redux-form, onSubmit is not. handleSubmit is a prop "injected" into the Component by redux-form, onSubmit is not. More Query from same tag Empty Array is being returned before PromiseAll is resolved when used in useEffect method calling it directly on a reference to your decorated form component) But in your App.js you have accidentally used TodoForm instead of TodoList! having a chance to change name="submit" or id="submit", you could also prevent the error by making changes in the JavaScript. If onSubmit is called, and fails to submit for any reason, submitFailed will be set to true. The proper way would be to bind first and since bind returns a function you can call that immediatly. Apparently the second line of this function is somekind of function but this.props.onSubmit cant be a function. The TodoForm component takes a property "onSubmit". Why do you think this? on Submit (data); Again, any and all help is greatly appreciated. How to fix onSubmit function not showing state when button clicked? you either have to make sure you're supplying it yourself or just handle the . If there are no changes in the output (still getting an error) by implementing the Solution 3 i.e. You cannot use TodoForm directly without supplying the necessary props, so you get an error. 2 Answers Sorted by: 1 The react-redux connect function takes mapStateToProps as the first argument and mapDispatchToProps as the second argument.