menu_book Course Curriculum (Vue 3) expand_more
SFC & Templates
Reactivity
Components
Forms & DOM
Async & Routing Patterns
Composables
Learn Composables in Vue 3 with a dedicated explanation, a concept-specific example, a production caution, and a mastery check.
12 min read
•
Advanced
vue-3-039.vue
vue
<script setup>
import { ref,onMounted,onUnmounted } from "vue"; function useOnline(){const online=ref(navigator.onLine);const sync=()=>online.value=navigator.onLine;onMounted(()=>addEventListener("online",sync));onUnmounted(()=>removeEventListener("online",sync));return online};const online=useOnline()
</script>
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content