Thumbnail caption in vue.js with possibly missing fields in caption I am using the following to output a thumbnail with text. It works fine but I don't like having the use a conditional to check every prop before outputting.

E.g. this.post.user.name would indicate "cannot read property of null".
Some of the values coming from the database would be null.

Whats the standard procedure to do this?

&lt;template&gt;
    &lt;div class="col-md-3"&gt;
        &lt;div class="thumbnail"&gt;
            &lt;a :href="src"&gt;
                &lt;img :src="src"&gt;
            &lt;/a&gt;
            &lt;div class="caption"&gt;
                &lt;h4&gt;{{ post.make }}&lt;/h4&gt;
                &lt;h4&gt;{{ post.model }}&lt;/h4&gt;
                &lt;h4&gt;{{ userName }}&lt;/h4&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/template&gt;

&lt;script&gt;
    export default {
        props:{
            post:{
                type: Object,
                required: true
            }
        },
        data() {
            return {
                src:'',
                make: '',
                model: '',
                userName: ''
            }
        },
        mounted(){
            if (this.post.make !== null) {
                this.make = this.post.make
            };
            if (this.post.model !== null) {
                this.model = this.post.model
            };
            if (this.post.user !== null) {
                this.userName = this.post.user.name;
            }
        }
    }
&lt;/script&gt;
By using v-if I was able to come up with a solution I am comfortable with.

&lt;template&gt;
    &lt;div class="col-md-3"&gt;
        &lt;div class="thumbnail"&gt;
            &lt;a :href="src"&gt;
                &lt;img :src="src"&gt;
            &lt;/a&gt;
            &lt;div class="caption"&gt;
                &lt;h4 v-if="post.make"&gt;{{ post.make }}&lt;/h4&gt;
                &lt;h4 v-if="post.model"&gt;{{ post.model }}&lt;/h4&gt;
                &lt;h4 v-if="post.price" style="color:red;"&gt;{{ post.price }}&lt;/h4&gt;
                &lt;h4 v-if="post.user"&gt;{{ post.user.name }}&lt;/h4&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/template&gt;

&lt;script&gt;
    export default {
        props:{
            post:{
                type: Object,
                required: true
            }
        },
        data() {
            return {
                src:''
            }
        },
        mounted(){
            if (this.post.photos == 0 || this.post.photos === null) {
                return this.src = '/images/post-thumbnail.png'
            };
            this.src = '/storage/' + this.post.photos[0].name;
        }
    }
&lt;/script&gt;


I also considered not allowing null in the database so I would not have to check for it but that needed some special attention.