Hi Guys,
I am trying to use the setUserData() function in my react component to setup some metadata for the user logged in.
The code can not compile and I am getting the following error:
setUserData' is not defined no-undef
I thought I imported moralis correctly but may be missing something, could you please advise, see below the code.
Note that the user login (crypto) is taken care of in another component.
Also note that I imported moralis at the top of the page with:
import { useMoralis } from 'react-moralis'
The fields orgName, orgLocation, adminFirstName, adminLastName refer to columns fields for user metadata that I have added manually as columns on the moralis server dashboard.
const { isAuthenticated, user} = useMoralis()
const addOrganizationAdminMoralis = (organizationName, organizationLocation, adminFirstName, adminLastName) => {
if (isAuthenticated) {
console.log('The user is authenticated')
setUserData({
orgName: organizationName,
orgLocation: organizationLocation,
adminFirstName: adminFirstName,
adminLastName: adminLastName,
})
}
}
Could you please advise why is the code not compiling and why the setUserData function is not recognized?
Thank you