Skip to content

Instantly share code, notes, and snippets.

@indreklasn
Created December 17, 2019 11:58
Show Gist options
  • Save indreklasn/e5458175e5d726900f0862b21730f619 to your computer and use it in GitHub Desktop.
Save indreklasn/e5458175e5d726900f0862b21730f619 to your computer and use it in GitHub Desktop.
const NoteForm = ({ form, notes, setNotes }) => {
const { getFieldDecorator, validateFields, resetFields } = form;
function handleSubmit(e) {
e.preventDefault();
validateFields((err, values) => {
if (!err && values.note) {
createNote(values.note).then(res => {
const newNotesArray = notes.concat([res])
setNotes(newNotesArray)
toast.success('Added Successfully')
resetFields()
})
}
});
}
... //
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment