Meteor 1.3, React and current user problems

Edit: I just needed to add the accounts-base package. D’oh!


I have this simple container:

import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import AppLayout from '/imports/ui/layouts/AppLayout.jsx';

export default createContainer(({ params }) => {
  const currentUser = Meteor.userId();

  return {
    currentUser
  };
}, AppLayout);

And this is the error I get:

AppContainer.jsx:6
Uncaught TypeError: _meteor.Meteor.userId is not a function

But in WebStorm, I can CMD+click the userId() function and go to the definition just fine.

Any tips?

According to this, it should be working just fine, right?

http://docs.meteor.com/#/full/meteor_user

Excuse my d’oh moment. I needed to add the accounts-base package.

1 Like

Hahaha, just started a new app some days ago and had the exact same problem :smile: That’s something I’ll probably forget about again, until I start the next app :yum:

1 Like

I added the accounts-base package but still keep getting this same error. Does anyone have any advice? I’m brand new tbh

1 Like

I’m into my gazillionth app and there are oh god so very inexplicably trivial things that I need to check and fix every! single! time! :smiley:

2 Likes