Moralis Link stop working

This function was working properly on react, Now it is not working, could not find a way to fix it.

 Moralis.onAccountsChanged( async (accounts) => {
                const result =await Moralis.link(accounts[0]);
                if (result) {
                    Router.reload()
                }
            });

Error

# Unhandled Runtime Error

Error: Cannot add elements to a non-array value

##### Call Stack

###### AddUniqueOp.value

node_modules/moralis/lib/browser/ParseOp.js (466:0)

###### ParseUser.value

node_modules/moralis/lib/browser/ParseObject.js (1202:0)

###### ParseUser.value

node_modules/moralis/lib/browser/ParseObject.js (1392:0)

###### eval

Problem fixed, On ReactJs if you don’t have β€œuser” as blow it is not working, once you add it. it is working fine

const {enableWeb3, isWeb3Enabled, Moralis, isAuthenticated, user} = useMoralis()

2 Likes