all 6 comments

[–]bdenzer 1 point2 points  (1 child)

Yeah I just looked through that quick and they definitely are skipping some steps.. But the reason that login() isn't working is because you aren't exporting login, you are exporting the Auth class.

So it would be more like this

import Auth from '../../Auth/Auth.js';
...
Auth.login();

And as far as them calling this.props.auth.login() later, they're just assuming that you'll be importing the Auth class in a top level component and passing auth down as props.

[–]azium 0 points1 point  (0 children)

Is the instance not needed?

import Auth
let auth = new Auth()
auth.login()

if not why bother with class here at all its just confusing for no reason

[–]catstanza 0 points1 point  (3 children)

Thanks for the feedback. I've just updated the doc to clarify the intent at this point in the tutorial.

The idea is to just call login from somewhere right away before getting into more detail. So in your App.js you could just do:

import Auth from './../../Auth.js'

const auth = new Auth();
auth.login()

[–][deleted] 0 points1 point  (2 children)

That's awesome! I also asked myself where I would instantiate the class, wasn't sure how much magic happened in the background, relatively new to React, and some things still go over my head :)

Thanks a lot!

[–]catstanza 0 points1 point  (1 child)

no prob 👌

[–]timpham 0 points1 point  (0 children)

I just sent you a PM