- [Instructor] So now there's our actual query.…Now what we want to do is we want to…get the data from this query.…So we're going to say const data…equal to cache dot read query.…And then we'll specify query and then…pass it our selected widget IDs query.…This will actually query our cache returning…the data back to our data variable.…Now what we want to do is we actually want to…we want to perform whatever function we've defined here…to either add or remove the actual ID…from the array of selected widget IDs.…
So I'm going to come into here and say const…and we're going to say new data equal to.…First I want to copy over all the properties…of the original data just in case something else…gets added to the query in the future or what have you.…I want to copy anything else I have so I don't lose it.…Then I want to update my selected widget IDs.…And to do this, I'm going to call…the selected widget IDs function.…And into it I'm going to actually pass…my array of selected widget IDs…as well as the actual widget ID.…
Skill Level Advanced
GraphQL Essential Training (2018)with Emmanuel Henri1h 54m Intermediate
React.js Essential Training (2018)with Eve Porcello1h 25m Intermediate
1. Apollo Client State with React
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.