Closed shaialoni closed 2 years ago
When you have an error like that, it means that whatever you are trying to push
to is coming up as undefined. Run some console.logs to see why developer.data.projects
is returning that way.
I was accessing it wrong - but now it's building the data correctly, but not saving it: Is it because I am using a get route to get the file? Should I be using a patch route?
Got it, using a patch route instead. Thank you!
Great!
What stack are you using?
(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)
MERN
What's the problem you're trying to solve?
Trying to findbyid, then push an object id to the ref array
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
TypeError: Cannot read properties of undefined (reading 'push') at ProjectForm.js:119:1
What is your best guess as to the source of the problem?
Not sure - used this exact method before so expected this to work
What things have you already tried to solve the problem?
Checked documentation to be sure
Paste a link to your repository here https://github.com/tylly/project-4-mongoose-express