I am currently working on a Twitter clone, using Vue 3. The source code for the same can be found here.
The code for the HomeView.vue is as follows:
<template>
<div class="home">
<Tweet
v-for="tweet in tweets"
:key="tweet._id"
:tweet="tweet" />
</div>
</template>
<script>
import { ref } from 'vue';
import Tweet from '../components/Tweet';
import tweets from '../tweets';
export default {
setup () {
const tweets = ref(tweets);
return {
tweets,
Tweet
}
}
}
</script>
But upon executing the same I get the following error in the developer's console.
Uncaught (in promise) ReferenceError: Cannot access 'tweets' before initialization