1. What are simple image optimizations you’d apply?
Use modern formats (WebP/AVIF), responsive sizes (srcset/sizes), lazy-loading (loading="lazy"), and cache headers/CDN. Defer non-critical assets and prefetch route chunks for perceived speed.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Netflix · Vue Js
Practice Vue Js questions specifically asked in Netflix interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
31
Tagged for this company + subject
Company
Netflix
View company-wise questions
Subject
Vue Js
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Netflix Vue Js round.
Use modern formats (WebP/AVIF), responsive sizes (srcset/sizes), lazy-loading (loading="lazy"), and cache headers/CDN. Defer non-critical assets and prefetch route chunks for perceived speed.
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
created runs before the component is mounted; no DOM access yet—good for initializing state or starting async data fetches. mounted runs after the component is inserted into the DOM—use it for measuring elements, integrating third-party widgets, or DOM event listeners tied to the component’s root.
v-bind (or :) binds attributes and props to reactive values.
<img :src="avatarUrl">
An SPA loads the initial page once, then updates the view dynamically with JavaScript—no full page reloads. This reduces wait time and feels app-like. Vue handles this via components, routing, and reactive updates to the DOM.
In Vue 2, filters format text in templates (e.g., capitalization, dates). In Vue 3 they were removed from core—use computed properties or methods instead. The idea remains: keep formatting logic declarative and reusable.
SSR is supported via Nuxt or Vue SSR tooling, not core runtime.
Vue.js is a progressive front-end framework for building UIs and SPAs.
Slots let parents inject markup into a child component’s template. A default slot is unnamed and fills the primary content area. Named slots provide multiple targeted insertion points using <slot name="..."> and template v-slot:name in the parent.
<!-- Child.vue --> <template> <header><slot name="header" /></header> <main><slot /></main> <footer><slot name="footer" /></footer> </template> <!-- Parent.vue --> <Card> <template #header>Title</template> Body content <template #footer>Actions</template> </Card>
v-if adds/removes elements from the DOM based on the condition—better for infrequent toggles or heavy subtrees. v-show always renders the element and toggles display via CSS—better for frequent show/hide. For expensive child components, prefer v-if to avoid unnecessary mounting costs.
<CompA v-if="visible" /> <CompB v-show="visible" />
Expose a modelValue prop and emit update:modelValue when the internal value changes. This lets parent use v-model directly. You can also support multiple models with the v-model:foo syntax.
<!-- Child.vue -->
<script setup>
import { defineProps, defineEmits } from 'vue'
const props = defineProps({ modelValue: String })
const emit = defineEmits(['update:modelValue'])
function onInput(e){ emit('update:modelValue', e.target.value) }
</script>
<template><input :value="modelValue" @input="onInput"></template>Debounce user input, call an API, then set an error state on the field based on the response. Cancel stale requests via AbortController or a request token to avoid race conditions, and show inline feedback and a neutral state while checking.
let ctrl: AbortController | null = null
async function checkEmail(email:string){
ctrl?.abort(); ctrl = new AbortController()
const res = await fetch(`/api/exists?email=${email}`, { signal: ctrl.signal })
state.emailError = (await res.json()).exists ? 'Email already used' : ''
}Pair labels with inputs via for/id, use fieldset/legend for groups, aria-invalid/aria-describedby for errors, and proper roles on custom widgets. Manage focus on submit errors and ensure keyboard navigation works across all custom inputs.
ref() creates a reactive wrapper for a primitive or object with a .value property. Use ref for single reactive values (numbers, strings, booleans, dates, or when you need a single variable). In templates you access it without .value.
import { ref } from 'vue'
const count = ref(0)
count.value++Use watch for side effects that happen when data changes (fetching, debouncing, saving to localStorage, logging). Use computed for deriving new values for the view. watch doesn’t return a value to render; it performs effects.
In templates Vue auto-unwraps refs, so you don’t need .value. In script, you must access ref.value. This improves ergonomics while keeping explicitness in code.
v-model creates two-way binding between form inputs and component state. It updates the view when the data changes and updates the data when the user types or selects. It’s commonly used with <input>, <textarea>, and <select> elements, as well as with custom components that define a model prop and update event.
For single selects, v-model binds to one value. For multiple selects (multiple attribute), v-model binds to an array of selected values. The option’s value can be a string or an object via :value binding.
<select v-model="country">
<option :value="{ code: 'IN', name: 'India' }">India</option>
</select>
<select v-model="tags" multiple>
<option value="vue">Vue</option>
<option value="spa">SPA</option>
</select>Use a watcher or watchEffect with a debounce (setTimeout/clearTimeout or a utility) to delay the API call until the user pauses typing. Invalidate stale requests with AbortController or by tracking the latest token.
watch(() => form.username, (v, _, onInvalidate) => {
const ctrl = new AbortController()
const t = setTimeout(() => check(v, ctrl.signal), 300)
onInvalidate(() => { ctrl.abort(); clearTimeout(t) })
})setup() runs before component creation and has no this. You declare reactive state (ref/reactive), computed values, watchers, and methods. Return an object to expose bindings to the template (or use <script setup> which auto-exposes top-level bindings).
import { ref, computed } from 'vue'
export default {
setup(){
const count = ref(0)
const double = computed(() => count.value * 2)
function inc(){ count.value++ }
return { count, double, inc }
}
}Define a modelValue prop and emit update:modelValue when internal state changes. Wrap modelValue with a computed getter/setter to keep template bindings simple.
const props = defineProps<{ modelValue: string }>()
const emit = defineEmits(['update:modelValue'])
const model = computed({
get: () => props.modelValue,
set: v => emit('update:modelValue', v)
})Vue tracks dependencies while rendering: when reactive properties are read, they are recorded; when they change, Vue schedules an update for the components that used them. Vue 3 uses ES2015 Proxies (reactive, ref) to observe reads and writes, enabling more accurate tracking and fewer caveats than Vue 2’s getters/setters.
Bottlenecks usually come from large lists without keys, deep reactive objects triggering wide updates, heavy computed/watch logic, and unnecessary re-renders via v-if/v-for misuse. Diagnose with Vue Devtools (Component tree, perf timeline), browser Performance tab, and flame charts to see slow updates and costly layouts.
Enable production mode, tree-shaking, code-splitting via dynamic imports, vendor chunking, image compression, and preloading critical assets. Analyze bundles (e.g., visualizer) to spot large dependencies and switch to lighter alternatives.
Use E2E for user flows across pages: routing, forms, auth, and API integration. Assert URL changes, visible text, network stubs, and accessibility. Keep tests resilient by using data-testid selectors.
Add a bundle visualizer (rollup-plugin-visualizer), inspect chunks, replace heavy libs with lighter ones, tree-shake, and lazy-load rarely used features. Verify improvements with before/after reports.
Computed values are reactive and memoized for performance.
Directives (like v-if, v-for, v-bind) attach reactive behavior to markup.
Globally, configure app.config.errorHandler (Vue 3) or Vue.config.errorHandler (Vue 2) to capture uncaught component errors. Per-component, use the errorCaptured hook to intercept errors from child components and optionally prevent propagation by returning false. For async code, handle Promise rejections with try/catch or .catch.
// Vue 3 global
const app = createApp(App)
app.config.errorHandler = (err, instance, info) => { /* log/report */ }
// Per-component
export default { errorCaptured(err, vm, info){ /* cleanup */ return false } }Use watch(source, callback) for precise control: compare new/old values, watch specific sources, and set options like immediate/deep. Use watchEffect() for auto-tracked side effects that rerun whenever any reactive read inside changes. It’s great for quick, dependency-free reactions.
watch(() => props.id, (n, o) => fetchUser(n)) watchEffect(() => console.log(form.email))
Wrap a dynamic import with defineAsyncComponent and provide loading/error components and delays/timeouts. Pair with <Suspense> for async setup. This splits code and reduces initial bundle size.
import { defineAsyncComponent } from 'vue'
const Chart = defineAsyncComponent({
loader: () => import('./Chart.vue'),
loadingComponent: () => import('./Loading.vue'),
delay: 200,
timeout: 10000
})v-for iterates items and should use a unique :key for stability.
<li v-for="u in users" :key="u.id">{{ u.name }}</li>