Tips for using prop in computed properties
<p>I have a carousel component that receives a prop called 'mediaItems', which I use in a computed property to determine the end of the carousel: </p>
<pre class="brush:php;toolbar:false;">props: ['mediaItems', 'sliderHeading'],
computed: {
atEndOfList() {
return this.currentOffset <= (this.paginationFactor * -1) * (this.mediaItems.length / this.windowSize) this.paginationFactor;
},</pre>
<p>This results in the component being empty and I get a console error: </p>
<blockquote>
<p>Type error: this.mediaItems is undefined</p>
</blockquote>
<p>If I remove the computed property, the component loads the props and no console error occurs, but I need this computed property to determine the end of the carousel. </p>