Skip to content

Cannot read properties of undefined (reading '$socket') #36

@yongjiabidot

Description

@yongjiabidot

I tried 2 approaches below but still encountered the same issue. May I know how to resolve this issue?

  1. use @tawk.to/tawk-messenger-react,
    const onLoad = () => {
    console.log('Here', tawkMessengerRef);
    tawkMessengerRef.current.setAttributes({
    name: 'test',
    email: '[email protected]',
    });
    };
image
  1. useeffect to check if authenticated
    useEffect(() => {
    if (isLoggedIn && store.user) {
    // const hash = hashInBase64(store.user.email, window.TAWK_APIKEY);
    if (window.Tawk_API) {
    window.Tawk_API.setAttributes(
    {
    name: store.user.loginName ?? '',
    email: store.user.email ?? '',
    // hash: hash,
    },
    function (error) {
    if (error) {
    console.error('Tawk update user information error:', error);
    }
    },
    );
    }
    }
    }, [store.user]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions