-
-
Save amandeepmittal/60f8b8f110ebe95e427592e086c6d480 to your computer and use it in GitHub Desktop.
This file contains 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
// App.js | |
// ... | |
import { createNote, deleteNote } from "./graphql/mutations" | |
// inside App component, add this | |
deleteNote = async noteID => { | |
const { notes } = this.state | |
const input = { id: noteID } | |
const result = await API.graphql(graphqlOperation(deleteNote, { input })) | |
const deleteNoteId = result.data.deleteNote.id | |
const updatedNotesList = notes.filter(note => note.id !== deleteNoteId) | |
this.setState({ notes: updatedNotesList }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment