I've encountered an issue with my AppReplyToMessage
component. It's supposed to send data to the AppSendMessage
component in order to notify it that the message being sent is a reply. Here's how I'm implementing it: The AppReplyToMessage
component:
<script setup>
import { provide } from "vue";
import AppSendMessage from "../AppSendMessage.vue";
let props = defineProps({
message: {
type: Object,
required: true,
},
});
let message = toRefs(props).message;
const replyToMessage = () => {
const message = {
reply: true,
};
provide("reply", message);
};
</script>
<template>
<button@click="replyToMessage">
Reply
</button>
</template>
In the AppSendMessage
component, I'm trying to receive the data as follows:
<script setup>
const reply = inject("reply", null);
</script>
However, I'm encountering an error message stating
[Vue warn]: provide() can only be used inside setup().
in the console.