Skip to content

Instantly share code, notes, and snippets.

@kaievns
Created October 3, 2019 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaievns/828371cb298feb7750282994b3d0085b to your computer and use it in GitHub Desktop.
Save kaievns/828371cb298feb7750282994b3d0085b to your computer and use it in GitHub Desktop.
import { Form } from 'forms-kit'
import { ValidationError } from 'a-plus-forms'
const OurForm = ({ onSubmit, defaultValues }) => {
<Form onSubmit, dfeaul>
...
}
const PageContainer = () => {
const [addLink] = useMutation(blargh)
const onSubmit = async ({ url, label }) => {
if (itSADupe(url, label)) {
throw new ValidationError('`url` is a dupe!');
} else {
return addLink({ variables: { url, lable });
}
}
return <Form onSubmit, defaultValue />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment