Doguhan Uluca PRO
Author of the best-selling Angular for Enterprise-Ready Web Apps. Google Developers Expert in Angular. Agile, JavaScript and Cloud expert, Go player.
Doguhan Uluca
Principal Fellow at
@duluca
Modern Software Delivery
The browser is a complicated runtime environment
The frameworks we use obfuscate the runtime in exchange for rich features and easier to maintain code
Frameworks of 2023 are really complicated in their own right
Credit Michael Hladky
Credit Michael Hladky
Created by Miško Hevery @mhevery
Supported by Builder.io
Adam Bradley @adamdbradley
Manu Corporat @manucorporat
5-10x faster websites
Full page load under 1 second, at scale
Easy to adopt (use 1 command/click)
Credit Cube Drone
Sandbags of Complexity
export const HelloWorld = component$(() => {
return <div>Hello world</div>;
});
export const Button = component$(() => {
return <button onClick$={() => console.log('click')}>Click me</button>;
});
export const LocalStateExample = component$(() => {
const state = useSignal({
value: 0,
});
return <div>Value is: {state.value}</div>;
});
Server-Side Rendering (SSR) is expensive
Engineers are expensive
Experts are even more expensive
Hydration
Ready
Ready
Resumable
Bind listeners
Parse & execute JS
Download all page JS
Get HTML
Get HTML
app.ts
rootRouter
services
pipes
modules
/a: default
/master
/detail
/b/...
/c
childRouter
/d
/e
/f
App.js
Presentational
Container
Provider
Router
Component Legend
react-router
react-redux
Goals:
Solutions:
Express listeners such that browser doesn't need to
eagerly load and process all listeners and event handlers
<button on:click="./chunk.js#handler_symbol">click me</button>
QRL (Qwik URL) points to a JS chunk to be lazily executed
Isolate dependencies, then serialize state into HTML
JSON.stringify(component)
Qwik can serialize components and static/reactive state
Serializable
Circular references
DOM references
Promises
Function closures
(if wrapped in QRL)
Dates
URL
objects
Map
and Set
instances
Not serializable
Classes
(instanceof
and prototype)
Streams
Qwik enforces scalable patterns
Developers don't need a crystal ball to optimize the application
useSignal() or useStore() allows reactive state management
import { component$, useStore } from '@builder.io/qwik';
export const MyCmp = component$((props: MyCmpProps) => {
const count = useSignal(0);
return (
<>
<span>
Hello, {props.name} {count.value}
</span>
<div>Times: {count.value}</div>
<button
onClick$={() => {
count.value++;
}}
>
Increment
</button>
</>
);
});
Components can use other components and pass values
export const Counter = component$((props: {step?:number, initial?: number}) => {
...
});
export const MyApp = component$(() => {
return (
<>
<div>Single: <Counter /></div>
<div>Dozens: <Counter step={12}/></div>
</>
);
});
Simple Parent-Child Relationship
export const Child = () => <span>child</span>;
const Parent = () => (
<section>
<Child />
</section>
);
export const Child = component$(() => {
return <span>child</span>;
});
export const Parent = component$(() => {
return (
<section>
<Child />
</section>
);
});
Wrap with component$()
Optimizer transformation
const Child = componentQrl(qrl('./chunk-a', 'Child_onMount'));
const Parent = componentQrl(qrl('./chunk-b', 'Parent_onMount'));
const Parent_onMount = () => qrl('./chunk-c', 'Parent_onRender');
const Parent_onRender = () => (
<section>
<Child />
</section>
);
<div>
<section>
<div></div>
</section>
</div>
onRender
🦥
Issues:
Solutions:
Credit Michael Hladky
Adapted from Michael Hladky
zone
.js
TICK
UPDATE
_
Idling
Dirty marking
Rendering
Adapted from Michael Hladky
Idling
Dirty marking
Rendering
Adapted from Michael Hladky
Idling
Dirty marking
Rendering
_
Credit Michael Hladky
Keeps track of subscription automatically
export const ComplexCounter = component$(() => {
const state = useSignal({ count: 0, visible: true });
return (
<>
<button onClick$={() => (state.visible = !state.visible)}>
{state.visible ? 'hide' : 'show'}
</button>
<button onClick$={() => state.count++}>increment</button>
{state.visible ? <span>{state.count}</span> : null}
</>
);
Can always compute the smallest set of invalidated components
Reactivity enables best possible rendering performance
App performance doesn't suffer as the application grows in complexity
We're hiring, including fully remote positions!
By Doguhan Uluca
At scale everything breaks. All the Angular and React in the world can't help, when even laws of physics break down at different scales. Qwik is an upcoming new framework to build web applications with O(1) scalability. It forgoes hydration in of favor resumability and embraces server-side-rendering in a seamless/magical way. Qwik has plans to implement React and Angular integrations in the future, so this is definitely a framework to watch and experiment with.
Author of the best-selling Angular for Enterprise-Ready Web Apps. Google Developers Expert in Angular. Agile, JavaScript and Cloud expert, Go player.