windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Vue waiting for data from props before using

Asked By: Anonymous

I keep running into an issue where I am awaiting data from a prop to do something within it inside my created hook. It keeps throwing errors such as “this.value is not defined” (As it has not yet loaded from prop)

I have fixed some of these issues using v-if and only using as needed. However in some cases I wanted to use that prop info within my created and when that happens, I end up getting errors and am not sure how to best tell that part of the created to “wait” for the data before running.

Any advice?

Update to add some example code.

On the App.js page, I am calling in the “userInfo” and setting it in data like so. I am doing this for two reasons. First to check if user is logged in, and secondly taking the time to save the users info as it will be used later on throughout the app. (Please note, user and userInfo are different and contain different info. User is email/password whilst userInfo is username, bio, etc.)

data() {
  return {
    user: null,
    userInfo: null,
//let user = firebase.auth().currentUser
  firebase.auth().onAuthStateChanged((user) => {
      this.user = user
      let ref = db.collection('users')
      .where('user_id', '==', this.user.uid)
      ref.get().then(snapshot => {
      snapshot.forEach(doc => {
        this.userInfo =

    } else {
      this.user = null

Now, I pass this information down within the using v-bind. and then call it in areas I need some info using props.

The issue comes when I want to do something such as –

if(this.userInfo) {
  value = true  

Calling this.userInfo throws an error “this.userInfo is null” (I set it to null in the data() of the page as default).


Answered By: Anonymous

As already mentioned in the comments, you’re running into a Promise resolving issue. When passing a result as a Prop which gets resolved by a Promise, that result will basically be empty which eventually will lead to an error in your Child Components created() hook.

I would recommend using v-if as you’ve already done in the Child Component itself. However, I’d use the v-if in the Parent Component to simply show/hide the Child. That should not only resolve the problem within your created() hook, but also help building up a more readable markup in your Child Component where you could just remove all v-ifs.

So let’s assume you have a Parent/Child relationship like that.

  <SomeChildComponent :someProp="yourProp" />

When yourProp is set after a resolving Promise, the initial value will be null, undefined, or whatever you’ve set it to. To avoid passing in an empty prop you can just wrap the in a v-if which’s expression evaluates to yourProp just like so.

  <SomeChildComponent :someProp="yourProp" v-if="yourProp" />
</SomeParentComponent>                           <!-- ^-- See here -->

Doing so, the Child will only be rendered when yourProp is set and therefore you won’t get any errors anymore.

techinplanet staff

instagram volgers kopen volgers kopen buy windows 10 pro buy windows 11 pro

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Çanakkale escort Aydın escort Muğla escort Tekirdağ escort Manisa escort Balıkesir escort Trabzon escort Elazığ escort Ordu escort Kütahya escort Isparta escort Rize escort Kahramanmaraş escort Yalova escort Giresun escort Yozgat escort Tokat escort Şanlıurfa escort Sivas escort Batman escort Erzurum escort Sinop escort Kırşehir escort Karaman escort Kırıkkale escort Bolu escort Amasya escort Niğde escort Uşak escort Edirne escort Çorum escort Osmaniye escort Zonguldak escort Van escort Erzincan escort Söke escort Bodrum escort Çerkezköy escort Akhisar escort Bandırma escort Ayvacık escort Akçaabat escort Karakoçan escort Altınordu escort Tavşanlı escort Eğirdir escort Ardeşen escort Afşin escort Altınova escort Bulancak escort Sorgun escort Erbaa escort Viranşehir escort Zara escort Kozluk escort Aziziye escort Ayancık escort Kaman escort Ermenek escort Keskin escort Gerede escort Göynücek escort Bor escort Banaz escort Havsa escort Osmancık escort Bahçe escort Alaplı escort Başkale escort Kemah escort Nazilli escort Fethiye escort Çorlu escort Alaşehir escort Altıeylül escort Biga escort Araklı escort Kovancılar escort Fatsa escort Simav escort Yalvaç escort Çayeli escort Dulkadiroğlu escort Çiftlikköy escort Espiye escort Sarıkaya escort Niksar escort Suruç escort Yıldızeli escort Sason escort Horasan escort Boyabat escort Mucur escort Sarıveliler escort Yahşihan escort Göynük escort Gümüşhacıköy escort Çamardı escort Eşme escort İpsala escort Sungurlu escort Hasanbeyli escort Çaycuma escort İpekyolu escort Refahiye escort Kuşadası escort Marmaris escort Süleymanpaşa escort Turgutlu escort Susurluk escort Gelibolu escort Of escort Ünye escort Domaniç escort Fındıklı escort Elbistan escort Çınarcık escort Tirebolu escort Akdağmadeni escort Turhal escort Eyyübiye escort Suşehri escort Yakutiye escort Gerze escort Mengen escort Merzifon escort Ulukışla escort Sivaslı escort Keşan escort Kadirli escort Ereğli escort Özalp escort Tercan escort Efeler escort Didim escort Çine escort Dalaman escort Menteşe escort Milas escort Ortaca escort Seydikemer escort Ergene escort Kapaklı escort Malkara escort Salihli escort Şehzadeler escort Soma escort Yunusemre escort Ayvalık escort Bigadiç escort Burhaniye escort Gönen escort Karesi escort Çan escort Yenice escort Ortahisar escort Yomra escort Perşembe escort Pazar escort Onikişubat escort Pazarcık escort Türkoğlu escort Eynesil escort Görele escort Piraziz escort Yağlıdere escort Çayıralan escort Boğazlıyan escort Zile escort Siverek escort Karaköprü escort Haliliye escort Akçakale escort Şarkışla escort Gemerek escort Oltu escort Palandöken escort Mudurnu escort Suluova escort Taşova escort Toprakkale escort Kilimli escort Tuşba escort Üzümlü escort