Setting Meteor.userId() as a reactive var on react

Hi,

I just switched from blaze to react, and I want to set the

state = {
    isLoggedIn: !!Meteor.userId()
}

so it will be reactive (= constantly change the state according to if the user is logged in or not and thus change which Components appear (and re-renders if

this.state.isLoggedIn

value’s changes.

I wanted to use mixins but I understand that they are no longer supported. and I’m quite confused: slight_smile:

would love to hear recommendations as to how is best to build it

thanks!

please read this section of the guide: https://guide.meteor.com/react.html#data

1 Like