score:0

you would need to use context api. i have made a gist that have a simple approach for that.

there is a simple mistake you are making

you can import a method from a class

import { onloggedout } from '../app/app';
import { app } from '../app/app';

i'm not sure how you are doing this import, but

  • if onloggedout is inside app, you can't do that type of import.
  • if onloggedout is outside app, it would never work, because it uses this.setstate.

you need to some something that is called lifting state up, but for authentication, it's better to use context api. i have made a gist (it's kind of the same, but better for your case).


Related Query

More Query from same tag