[Vuejs]-Although rootState.user.user_data returns an object, rootState.user.user_data.uid returns null

0👍

You can write custom getters for these properties, this way you’ll have a more maintainable and modular function to access the vuex state and its modules.

E.g

getters: {
    getUserUid: state => {
        // here you can do some logs for faster debug
        return state.user.user_data.uid
    }
}

Leave a comment