Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 93

Vue, Angular & Svelte2 min read

How do you manage router scroll behavior and history position restoration?

Use scrollBehavior to return savedPosition on popstate and top: 0 on new navigations; handle hash anchors and async delays.

Vue, Angular & Svelte2 min read

How do you implement a data-fetching Composable in Vue 3?

Write useFetch accepting a URL, exposing data, loading, and error refs, then return them.

How to create a singleton Angular auth service
Vue, Angular & Svelte2 min read

How to create a singleton Angular auth service

Tests Angular dependency injection and singleton scope. Strong answer: use the Injectable decorator with providedIn set to root for an application-wide singleton, then inject it into components.

What is a Svelte Action? Write a simple logging action.
Vue, Angular & Svelte2 min read

What is a Svelte Action? Write a simple logging action.

Define a function receiving the node, log a message, and optionally return destroy.

Vue, Angular & Svelte2 min read

Would you use a Service or a custom Pipe for currency formatting?

Choose Pipe for declarative syntax; implement PipeTransform with transform(value, ...args); use Intl.NumberFormat; register standalone.

Vue, Angular & Svelte2 min read

Vue 3 Composables vs Vue 2 Mixins: differences and problems solved

Tests why Vue replaced mixins with composables for stateful logic reuse. Answers cite property collisions, unclear origin, inflexible config, and weak type inference.

How would you create a parameterized Svelte tooltip Action?
Vue, Angular & Svelte2 min read

How would you create a parameterized Svelte tooltip Action?

It tests your grasp of the Svelte Action lifecycle for reactive parameters. Answer: action takes node and parameter, returns update and destroy, bound as use:tooltip={text}. Using component events instead of the Action API, or omitting update, is a red flag.

Vue, Angular & Svelte2 min read

Architect reusable form validation in Vue vs Angular

Tests how you encapsulate reactive state across frameworks. Contrast Vue's useForm composable returning refs and lifecycle hooks. Contrast Angular's service exposing a FormGroup via RxJS.

Vue, Angular & Svelte2 min read

How would you design useCounter to support shared or independent state?

Tests your grasp of scope in Vue composables. Great answers contrast module-level refs for global singleton state against function-level refs for per-instance isolation, and explain tradeoffs.

Vue, Angular & Svelte2 min read

When would you provide an Angular service at the component level?

Tests Angular DI scoping beyond singletons. A strong answer picks stateful reusable widgets, explains providers create one instance per subtree, and notes cleanup on destroy. Red flag: claiming this is for performance without mentioning state isolation.

Explain Svelte Action update and provide a reactive CSS example
Vue, Angular & Svelte2 min read

Explain Svelte Action update and provide a reactive CSS example

Tests Svelte actions beyond initial mount. Strong answers explain update re-runs when parameters change, give a CSS custom properties example, and contrast with destroy. Red flag: suggesting the action re-runs from scratch or using reactive statements.

Vue, Angular & Svelte2 min read

Vue computed vs method: performance difference and when to choose each?

This tests Vue reactivity caching. Answer: computed caches and reruns only when reactive deps change, while methods run each render. Choose computed for derived data; methods for events/args. Red flag: saying computed is always faster or passing arguments.

How do you lazy-load a route in Vue or Angular?
Vue, Angular & Svelte2 min read

How do you lazy-load a route in Vue or Angular?

Tests route-level code splitting. Strong answers mention dynamic imports in Vue Router or Angular loadChildren and highlight a smaller initial JS bundle. Red flag: confusing this with image lazy loading or claiming it speeds up runtime navigation.

How would you use dynamic import() to lazy-load a component-specific library?
Vue, Angular & Svelte2 min read

How would you use dynamic import() to lazy-load a component-specific library?

Tests lazy loading and bundle splitting. Good answers call import() inside the component lifecycle, await the module namespace, let the bundler split the chunk, and handle loading and error states. Bad answers put import() at top level, defeating lazy loading.

Why does an OnPush Angular child not update when its input changes?
Vue, Angular & Svelte2 min read

Why does an OnPush Angular child not update when its input changes?

Tests OnPush reference equality and manual change detection. Strong answers name: in-place object mutation as the root cause; ChangeDetectorRef.markForCheck or detectChanges to force updates; and Angular Signals as a modern path.

How does Svelte surgically update the DOM without VDOM?
Vue, Angular & Svelte2 min read

How does Svelte surgically update the DOM without VDOM?

Tests VDOM overhead vs compile-time optimization. A strong answer explains that Svelte compiles reactive dependencies into direct DOM API calls, skipping tree creation and diffing. Red flag: claiming VDOM is slow because the DOM itself is slow.

Implement virtual scrolling for a large list in Vue
Vue, Angular & Svelte2 min read

Implement virtual scrolling for a large list in Vue

Tests DOM cost awareness and viewport culling. Strong answer: mount only visible nodes plus overscan, recycle DOM on scroll, and preserve total scroll height with a spacer. Red flag: suggesting pagination or naive v-for without keys.

Vue, Angular & Svelte1 min read

Zone.js and change detection optimization in Angular?

Zone.js wraps async (timers, events, HTTP), triggering change detection after each; use runOutsideAngular when external libraries fire high-frequency events.

How do you architect Svelte stores to minimize WebSocket re-renders?
Vue, Angular & Svelte2 min read

How do you architect Svelte stores to minimize WebSocket re-renders?

Tests Svelte store granularity and subscription semantics. A great answer splits the monolith into domain stores, uses derived selectors to isolate slices, and leverages readable stores to encapsulate the WebSocket source.

Vue, Angular & Svelte2 min read

What is the fundamental difference between unit and component tests?

Isolation levels in frontend testing. Unit tests verify single functions or composables with mocked dependencies; component tests verify mounting, rendering, and interaction and pull in more code.