firebase – Mobx observale value is null when used in useEffect hook


I am trying to get userdata from firestore based on uid obtained from authStatechanged in mobx. But when i try to access it in useEffect, it shows value is undefined but if i print its value in body it shows after slight delay. What should i fo to get that value in useeffect.

index.js

 useEffect(() => {
      setposts(props.posts);
    authUser && setuser(authUser) ; //These does not work
    
    }, ());

  return (
   
 <Layout>
     
 {authUser && authUser.uid}  //These work

</Layout>


store.js

class Store {

  @observable authUser = null


  constructor(){
       
        const result = firebase.auth().onAuthStateChanged(authUser => { 

        if(authUser){
          this.authUser = authUser
        }
       })
    }
}