Hide certain Objects when a user is loggedIn

Hi, I am new to Wix Code. I just wanted to hide the text if a user logs in. It doesn’t work and I am not sure why.

After my understandig the information from loggedIn (true, or false) is stored in the variable isLoggedIn. Then in the if statement it checks if it’s true or not and if its true it should do something, but its not, unfortunately.

It also gives me an error that ‘user’ is not defined although i copied the let statement from the Corvid References Page.

#help #loggedIn #user

import wixUsers from 'wix-users';

let isLoggedIn = user.loggedIn;

 $w.onReady( function() {
 if (isLoggedIn === true) {
        $w('#text12').hide();
 
    }
} );

Try this

import wixUsers from 'wix-users';

 $w.onReady( function() {
 if(wixUsers.currentUser.loggedIn === true) {
        $w('#text12').hide();
    }
} );