i am following this tutorial. https://www.youtube.com/watch?v=4deVCNJq3qc
below is my code for QuestionBox.vue
<template>
<div>
{{ currentQuestion.question}}
</div>
</template>
<script>
export default {
props: {
currentQuestion: Object
}
}
</script>
Below is code for App.vue
<template>
<div>
<Header />
<QuestionBox
:currentQuestion="questions[index]"
/>
</div>
</template>
<script>
import Header from './components/Header.vue'
import QuestionBox from './components/QuestionBox.vue'
export default {
name: 'app',
components: {
Header,
QuestionBox
},
data(){
return {
questions:[],
index:0
}
},
mounted: function(){
fetch('https://opentdb.com/api.php?amount=4&type=multiple',{
method: 'get'
})
.then((response) => {
return response.json()
})
.then((jsonData) => {
this.questions = jsonData.results
})
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
when i compile the code it succeeded but i am not getting the expected result which is question from index 0, instead when i do inspect i am getting error Uncaught TypeError: $props.currentQuestion is undefined .
I am stuck there for 2 days, What i am doing wrong? Please help. Thanks in advance.