• Overview
  • Installation
  • Quick start
  • API reference
    • useField
    • Scope
  • Guides
    • Basic form
    • React Native
    • Initial data
    • Complex structures
    • Validation
    • Get/set field value
    • Get/set field error
    • Reset form
    • Manual form submit
  • Recipes
    • Simple Input
    • Accessing form ref
    • Accessing field ref
    • Styled Components
    • Clear input error on focus
    • Accessing form event
    • TypeScript
  • Examples
    • File input
    • React Select
    • React DatePicker
    • React Dropzone
    • React Simple Code Editor
    • React Input Mask
    • React Native Input Mask
    • React Native Picker Select
    • More Examples
  • More
    • Roadmap
    • Migration guide
    • Github
    • React Demo
    • React Native Demo

Unform

Accessing form event

Accessing form event

On the web, you can access the form event in the 3rd parameter of the submit function.

1export default function MyForm() {
2 function handleSubmit(data, { reset }, event) {
3 console.log(event)
4 }
5
6 return <Form onSubmit={handleSubmit}>...</Form>
7}
Edit this page on GitHub

Prev

Clear input error on focus

Next

TypeScript