Created
December 17, 2019 11:58
-
-
Save indreklasn/e5458175e5d726900f0862b21730f619 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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