Skip to content

Instantly share code, notes, and snippets.

@erikras
Last active March 19, 2018 19:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikras/f1aa102400036a638ff3a170f2169f62 to your computer and use it in GitHub Desktop.
Save erikras/f1aa102400036a638ff3a170f2169f62 to your computer and use it in GitHub Desktop.
🏁 Final Form Focus 🧐
import React from 'react'
import { Form, Field } from 'react-final-form
import createDecorator from 'final-form-focus'
const focusOnErrors = createDecorator()
...
<Form
onSubmit={submit}
decorators={[ focusOnErrors ]} // <--------- 😎
validate={validate}
render={({ handleSubmit }) =>
<form onSubmit={handleSubmit}>
... inputs here ...
</form>
}
/>
@juandc
Copy link

juandc commented Mar 19, 2018

You need a " ' " my friend πŸ˜…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment