Meteor.User coming Undefined

So for some reason Meteor.user() is coming undefined for me even though I’m logged in.
I’m using Webstorm so it tells me on telling me module not installed when I import meteor from ‘meteor/meteor’

This is my first project in React with Meteor maybe I haven’t installed some specific modules. Here is my code

//Importing Packages
import React, { Component } from 'react';
import { Meteor } from 'meteor/meteor';
import  { Redirect } from 'react-router-dom'

//Importing Local Components/Files
import Lost from '../../notFound/Lost';


export default class FinishRegister extends Component {

    logValue(){
        console.log(Meteor.user());
        return Meteor.user()
    }


    serviceCheck(service){
        Meteor.call('finishRegister',service,(error, result) => {
            if (error) {
                alert(error);
            } else {
                return result;
            }
        });
    }


    lowerCasing(){
        return this.props.match.params.service.toLowerCase();
    }


    render() {
        if (this.logValue()){
            if (this.serviceCheck(this.lowerCasing())){
                return (
                    SOME CODE
                );
            }else{
                return <Lost/>
            }
        }else {
            return <Redirect to='/login' />
        }
    }
}

Here is a screenshot of my console. The Undefined part id from logValue function in the code I sent.

Hello ,

Meteor.user() is a reactive data source as per the docs. Initially it’ll be undefined after login but then it’ll be populated.

One way is to use Tracker to update the state of the react component. So in the componentDidMount() you can use something along those lines:

this.computation = Tracker.autorun(() => {
      if (Meteor.user() !== undefined) {
        this.setState({
          user: Meteor.user()
        });
      }
    });

I hope that helps…

This is a known limitation in Webstorm with Meteor and it’s being tracked here.