const newNoteMutation = useMutation({
mutationFn: createNote,
onSuccess: (newNote) => {
const notes = queryClient.getQueryData('notes')
queryClient.setQueryData('notes', notes.concat(newNote))
}
})
In the lesson part 6d - Optimizing the Performance, and the provided code, 'notes' is passed as a string to const notes = queryClient.getQueryData('notes'), making notes equal to null. Creating a new note through the form saves it to db.json but the page doesn't get updated with the new entry.
If instead both queryClient.setQueryData and .getQueryData were given ['notes'], the page updates like it is described in the lesson.