The course is part of this learning path
This module looks at React Event Forms.
The objectives of this module are to provide you with an understanding of:
- React event forms
- React form components
- Form Submission
This learning path is aimed at all who wish to learn how to use the ReactJS framework.
We welcome all feedback and suggestions - please contact us at firstname.lastname@example.org to let us know what you think.
Form management is done by event handling. So it's important that we understand how React works with any DOM style events little more before we delve into working with forms. In an earlier video, we said we could use any event that could be called on a DOM element in a react component. With some subtle syntactic differences, events used in JSX should be comelCased rather than in lowercase. So onclick becomes onClick, onmouseover becomes onMouseOver and so on. React will usually recognize the event in any case, but warnings will be given in the console. In JSX, you pass a function as the event handler rather than a string. So onclick with the function call to click handler as a string becomes onClick with a JSX expression. This is an arrow function that returns the call to click handler. You cannot make the handler function return false to prevent default behavior. You must explicitly use the preventDefault call in the handling function. And there is no need to ever call out event listener in react, you just provide the event and its handle callback when the element is initially rendered. We'll be using event handling with forms to trigger value changes in form submission as we go through the rest of this topic.
About the Author