Meteor 1.3, React and current user problems


#1

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?


#2

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

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


#3

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


#4

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:


#5

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


#6

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: