Qwik
The Resumable Framework
A next-generation web framework based on Resumability. Developed by Angular creator Miško Hevery. Delivers ultra-fast web apps that are interactive immediately without hydration.
The Resumable Framework
A next-generation web framework based on Resumability. Developed by Angular creator Miško Hevery. Delivers ultra-fast web apps that are interactive immediately without hydration.
Qwik is a next-generation web framework that introduces an innovative concept called "Resumability." Unlike existing frameworks, which must re-execute the server-rendered HTML on the client (Hydration) to make it interactive, Qwik serializes the application state executed on the server into the HTML so that the client can "resume" it as is. This enables immediate interaction without loading or executing JavaScript.
Qwik was developed at Builder.io by Miško Hevery, the creator of Angular and a former Engineering Director at Google. Having directly experienced the performance limitations of existing frameworks such as Angular and React, he concluded that a fundamentally different approach was needed. Qwik aims for "O(1) JavaScript" and maintains consistent initial loading performance regardless of application size.
Using Resumability instead of Hydration is Qwik's key differentiator. A traditional SSR framework generates HTML on the server, downloads the entire JavaScript on the client, and then re-executes the component tree to attach event listeners. This process is Hydration, and TTI (Time To Interactive) gets later in proportion to the bundle size. Qwik serializes event listeners and state into HTML attributes, and lazy loads the necessary code only when an actual user interaction occurs.
In practice, Qwik is ideal for projects that require ultra-fast loading and excellent SEO. In particular, it can dramatically improve Core Web Vitals scores in e-commerce, marketing sites, and content-driven web apps. Through a meta-framework called Qwik City, it provides full-stack features such as file-based routing, data loading, and middleware, and it uses JSX syntax, which is familiar to React developers.
| Characteristics | Hydration (React, Vue) | Resumability (Qwik) |
|---|---|---|
| Initial JS Load | Full bundle download required | Nearly 0KB (loaded on demand) |
| TTI (Time to Interactive) | Increases in proportion to bundle size | Immediate, regardless of app size |
| Server Work | Client re-executes after HTML generation | Client resumes by serializing state |
| Event Listeners | Attached after Hydration completes | Inlined in HTML and work immediately |
| Memory Usage | Entire component tree kept in memory | Only interacted parts loaded into memory |
Practical tip: The perceived performance difference with Qwik is greatest in slow network environments (3G) or on low-end mobile devices. It is effective for improving FID (First Input Delay) and INP (Interaction to Next Paint) in Google's Core Web Vitals.
// src/components/counter.tsx - Qwik 컴포넌트
import { component$, useSignal, $ } from '@builder.io/qwik';
// component$: Qwik의 컴포넌트 정의 ($ 접미사가 핵심)
export const Counter = component$(() => {
// useSignal: 반응형 상태 (React의 useState와 유사)
const count = useSignal(0);
// $: 이벤트 핸들러를 lazy-loadable하게 만듦
const increment = $(() => {
count.value++;
console.log('클릭됨! 이 코드는 클릭 시점에 로드됩니다');
});
// 서버에서 실행되는 함수
const fetchData = $(async () => {
// 이 코드도 호출 시점에 lazy load됨
const response = await fetch('/api/data');
return response.json();
});
return (
<div class="counter">
<p>Count: {count.value}</p>
{/* onClick$: 이벤트 핸들러도 $ 접미사 사용 */}
<button onClick$={increment}>+1 증가</button>
{/* 인라인 핸들러도 가능 */}
<button onClick$={() => count.value--}>-1 감소</button>
<button onClick$={fetchData}>데이터 불러오기</button>
</div>
);
});
// 상품 카드 컴포넌트 - Props 사용 예시
interface ProductProps {
name: string;
price: number;
imageUrl: string;
}
export const ProductCard = component$<ProductProps>((props) => {
const isHovered = useSignal(false);
// useTask$: 서버/클라이언트에서 실행되는 사이드 이펙트
// useVisibleTask$: 클라이언트에서만 (DOM 필요한 경우)
return (
<article
class={`product-card ${isHovered.value ? 'hovered' : ''}`}
onMouseEnter$={() => isHovered.value = true}
onMouseLeave$={() => isHovered.value = false}
>
<img
src={props.imageUrl}
alt={props.name}
width={300}
height={200}
/>
<h3>{props.name}</h3>
<p class="price">{props.price.toLocaleString()}원</p>
<button onClick$={() => alert(`${props.name} 장바구니 추가`)}>
장바구니 담기
</button>
</article>
);
});
// Qwik City - 파일 기반 라우팅 구조
// src/routes/
// ├── index.tsx → /
// ├── about/
// │ └── index.tsx → /about
// ├── products/
// │ ├── index.tsx → /products
// │ └── [id]/
// │ └── index.tsx → /products/:id (동적 라우트)
// └── layout.tsx → 레이아웃 (모든 페이지 공통)
// ============================================
// src/routes/products/[id]/index.tsx
// 동적 라우팅 + 데이터 로딩 예시
// ============================================
import { component$ } from '@builder.io/qwik';
import { routeLoader$, useLocation } from '@builder.io/qwik-city';
import type { DocumentHead } from '@builder.io/qwik-city';
// routeLoader$: 서버에서 데이터 로딩 (Next.js의 getServerSideProps와 유사)
// 이 함수는 절대 클라이언트에 전송되지 않음 (서버 전용)
export const useProductData = routeLoader$(async (requestEvent) => {
const productId = requestEvent.params.id;
// DB 직접 접근 가능 (서버에서만 실행됨)
const product = await db.products.findUnique({
where: { id: productId }
});
if (!product) {
// 404 페이지로 리다이렉트
throw requestEvent.redirect(302, '/404');
}
return product;
});
// 페이지 컴포넌트
export default component$(() => {
// useLoader의 반환값 사용
const product = useProductData();
const loc = useLocation();
return (
<main class="product-detail">
{/* .value로 데이터 접근 */}
<h1>{product.value.name}</h1>
<p class="price">{product.value.price.toLocaleString()}원</p>
<p>{product.value.description}</p>
<!-- 현재 URL 정보 -->
<p>현재 경로: {loc.url.pathname}</p>
<p>상품 ID: {loc.params.id}</p>
</main>
);
});
// SEO: 동적 메타 태그 설정
export const head: DocumentHead = ({ resolveValue }) => {
const product = resolveValue(useProductData);
return {
title: `${product.name} | My Shop`,
meta: [
{ name: 'description', content: product.description },
{ property: 'og:title', content: product.name },
{ property: 'og:image', content: product.imageUrl },
],
};
};
// ============================================
// src/routes/layout.tsx - 레이아웃 컴포넌트
// ============================================
import { component$, Slot } from '@builder.io/qwik';
export default component$(() => {
return (
<>
<header>
<nav>
<a href="/">홈</a>
<a href="/products">상품</a>
<a href="/about">소개</a>
</nav>
</header>
{/* Slot: 자식 페이지가 렌더링되는 위치 */}
<Slot />
<footer>
<p>© 2024 My Shop</p>
</footer>
</>
);
});
"Our Core Web Vitals scores keep falling short, and even after trying code splitting and applying lazy loading, there's a limit. The fundamental problem is Hydration. Users have to wait from the page load until the React bundle is downloaded and re-executed to attach events, right? Thanks to Resumability, Qwik doesn't have this process, so TTI is close to 0. Especially for a service like e-commerce, where initial loading is directly tied to revenue, it's worth serious consideration."
"It's not that React is bad; it's a limitation of the Hydration architecture itself. We're improving it with React 18's Streaming SSR and Server Components, but JavaScript execution on the client is still required. Qwik takes a completely different approach: the $ suffix makes every function serializable, so server state is encoded into the HTML. On the other hand, the ecosystem is not as mature as React's, and we also have to consider the team's learning curve. For a new project, Qwik; for an existing React project, Next.js 13+ App Router is the realistic choice."
"Qwik's core innovation is Resumability. Existing SSR renders on the server and reboots on the client through Hydration, whereas Qwik serializes the server execution state into HTML attributes so that the client resumes from where it left off. Functions with the $ suffix are split into separate chunks at build time and are requested over the network only at the time of the actual call. This is what makes O(1) JavaScript possible."
"This handler captures an external object in a closure, but in Qwik, only serializable values can be referenced inside a $ function. Class instances and DOM references can't be serialized. Manage state with useSignal, or pass only the values you need as parameters. And use useVisibleTask$ only when truly necessary. It runs only on the client, so you lose the benefits of Resumability. First check whether you can replace it with useTask$."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
Compared to React or Vue, the library and UI component ecosystem is limited. Some npm packages are not compatible with Qwik's serialization model, so you may need to write wrappers or find alternatives. The community is also small, so Stack Overflow and blog resources are scarce.
You need to understand the $ suffix (dollar sign) and Serialization rules. The pattern of adding $ to functions, event handlers, and hooks can feel awkward at first, and passing a non-serializable value (class instances, DOM references, etc.) causes a runtime error. Even developers with React experience need time to shift their mental model.
It targets modern browsers and does not support IE. Also, since server-side rendering is required for Resumability, static hosting alone cannot take advantage of Qwik's strengths. Deployment to edge runtimes such as Cloudflare Workers, Vercel Edge, and AWS Lambda@Edge is recommended.