facebookarchive / react-meteor

React rendering for Meteor apps
948 stars 114 forks source link

Get current user in GetMeteorState #12

Closed weeyoung closed 10 years ago

weeyoung commented 10 years ago

Hi

I tried to get current user in get meteorstate as follows. getMeteorState: function() { console.log(Meteor.user(); return { foo : 'foo' }; },

But I get Meteor.user() is undefined. Is there a way to retrieve current user in the state? It's a client code, so i believe the function (meteor.user()) is valid

weeyoung commented 10 years ago

Hi. Sorry. I realise that this is not really a react issue in the end. user has not fully logged in (when rendered).

had changed my code to wait for currentuser to be available {{#if currentUser}} {{invokeJsxAfterLoad}} {{/if}}

Thanks!

benjamn commented 10 years ago

Thanks for following up! Glad it ended up making sense.