Multiple Queries Next.js

This is more a question than anything else, let me provide a little background on my issue.

I have a profile page that uses getserversideprops to fetch the users profile page, this uses Moralis imported from Moralis/node. That works perfectly.

My issue is that I need to use query.get(profileId) to update said user profile.

but I cannot do that on the object returned from serversideprops.

So I turn to the useMoralisQuery hook from react-moralis. Now that queries fine, but how do I use that object returned from the hook to actually update the profile? I can’t seem to find anything in the react-moralis docs about updating objects besides the user object.

any help would be appreciated thanks!

Maybe it works with object.set and after that. If not, you can always make a cloud function that you could call and in the cloud function you could do the update.

Yeah I tried the object.set and it says it’s not a function unfortunately! thanks for the reply!

you can try to see what is the object, usually console.log(JSON.stringify(object)) works in react

1 Like

I ended up using seperate components, one to view the profiles that uses serversideprops, and then an update profile form component.

For anyone seeing this in the future, my issue was that to access Moralis database with getserversideprops on Next.js you have to import Moralis from ‘moralis/node’ but once you do that and try to use Moralis.query or any other Moralis function in the component it gives you this:

Error: Can’t resolve ‘fs’.

Hope this helps someone else!