I'm passing data to child component like this:
Parent.vue
<template>
<vote-buttons :data="data">
</vote-buttons>
</template>
props: {
comment: {type: Object}
},
setup(props) {
const data = {
'score': props.comment.score,
'hasVoteOfUser': props.comment.hasVoteOfUser,
}
return { data }
}
Child.vue
props: {
data: { type: Object }
},
// or
props: {
data: {
score: { type: Number },
hasVoteOfUser: { type: Boolean }
}
When i'm accessing {{ data.score }}
in child component, i'm getting Uncaught TypeError: $props.data is undefined
and just {{ data }}
renders whole object { "score": 1, "hasVoteOfUser": true }
.
Why rendering of one property doesn't work? Thanks