Vue Undefined Null

Posted on  by admin
Modified11 months ago.

I am trying to use a v-if statement to show some HTML only if the archiveNote variable is not empty/null.

Here is how it's instantiated . which is then passed in from this other Vue file.

The block of HTML still shows when archiveNote is console.log out as empty.

This gives the same result as the double bang:. Both of these expressions evaluate all 8 of JavaScript's falsy values to false:.

Steven SpunginSteven Spungin

1313 gold badges7878 silver badges9595 bronze badges. 9595 bronze badges. It might be caused by the fact that in the parent component you are assigning your variables to incorrectly named props :archive-name="archiveName" instead of :archiveName="archiveName".

6464 bronze badges. 1,57711 gold badge1212 silver badges2929 bronze badges.

1212 silver badges2929 bronze badges. You're happily coding along, loving how awesome Vue is, when it strikes.

Your VueJS app doesn't work, and you get an error that says:.

Don't worry, you're not alone — I've run into this issue countless times, and I'll show you just how to solve it.

The likely cause of this is that you're mixing up your usage of regular functions and arrow functions.

Steven SpunginSteven Spungin
Vikram BiwalVikram Biwal
After all, knowledge is power, and if you know what caused your problem, you'll be able to avoid a lot of frustration and wasted time in the future. There are also a few other places where you can get tripped up with this error:.