Most JavaScript frameworks ship a big bundle of JavaScript to the browser, then hydrate the whole page before it becomes interactive. Qwik flips that idea around: it ships almost no JavaScript upfront and loads code lazily, only when a user actually interacts with something. The result is a page that becomes interactive almost instantly, even on a slow phone.
Qwik works through a concept called resumability. Instead of re-running your components in the browser to rebuild state (hydration), Qwik serializes the state on the server and resumes exactly where the server left off. Your components are split into tiny pieces at build time, and each piece loads only when it is needed. A button's click handler, for example, is downloaded only when the user actually clicks that button.
Here is the smallest possible Qwik component:
import { component$, useSignal } from '@builder.io/qwik';
export const Counter = component$(() => {
const count = useSignal(0);
return (
<button onClick$={() => count.value++}>
Clicked {count.value} times
</button>
);
});
Notice the $ at the end of component$ and onClick$. That dollar sign is how Qwik knows where to split your code. Everything marked with $ becomes a separate lazy-loadable chunk. The useSignal hook holds state, similar to useState in React, but the component itself never re-runs in the browser unless its state changes.
Getting started is simple. Run npm create qwik@latest, pick a starter, and you get a working project with routing, server-side rendering, and the Qwik optimizer already configured. The default starter includes a small demo app you can edit to learn the patterns.
Qwik is a great fit if you care about page load speed above everything else — content sites, e-commerce pages, and marketing pages benefit the most. It is also a good choice if you like React-style components but want a fundamentally faster loading model.
There are limits. Qwik's ecosystem is smaller than React's, so you will find fewer ready-made component libraries. The $ syntax takes a little time to get used to, and some familiar patterns from React do not translate directly. Debugging lazy-loaded code can also feel different at first.
If you want to learn it properly, build one small project with it — a landing page with a few interactive widgets is enough. Measure the load time against the same page built in your usual framework. The difference is usually what convinces people.
Top comments (0)