Ember Octane vs Qwik Comparison
Reactivity
Declare state
Ember Octane
name.hbs
<h1>Hello {{this.name}}</h1>
name.js
Qwik
Name.tsx
import { component$, useSignal } from "@builder.io/qwik";
export const Name = component$(() => {
const name = useSignal("John");
return <h1>Hello {name.value}</h1>;
});
Update state
Ember Octane
name.hbs
<h1>Hello {{this.name}}</h1>
name.js
Qwik
Name.tsx
import { component$, useTask$, useSignal } from "@builder.io/qwik";
export const Name = component$(() => {
const name = useSignal("John");
useTask$(() => {
name.value = "Jane";
});
return <h1>Hello {name.value}</h1>;
});
Computed state
Ember Octane
double-count.hbs
<div>{{this.doubleCount}}</div>
double-count.js
Qwik
DoubleCount.tsx
import { component$, useSignal, useComputed$ } from "@builder.io/qwik";
export const DoubleCount = component$(() => {
const count = useSignal(10);
const doubleCount = useComputed$(() => count.value * 2);
return <div>{doubleCount.value}</div>;
});
Templating
Minimal template
Ember Octane
hello-world.hbs
<h1>Hello world</h1>
Qwik
HelloWorld.tsx
export const HelloWorld = () => {
return <div>Hello World</div>;
};
Styling
Ember Octane
css-style.css
/* using: https://github.com/salsify/ember-css-modules */
.title {
color: red;
}
css-style.hbs
Qwik
CssStyle.tsx
import { component$, useStyles$ } from "@builder.io/qwik";
export const App = component$(() => {
useStyles$(`
.title {
color: red;
}
`);
return (
<>
<h1 class="title">I am red</h1>
<button style={{ "font-size": "10rem" }}>I am a button</button>
</>
);
});
Loop
Ember Octane
colors.hbs
<ul>
{{#each (array "red" "green" "blue") as |color|}}
<li>{{color}}</li>
{{/each}}
</ul>
Qwik
Colors.tsx
import { component$ } from "@builder.io/qwik";
export const Colors = component$(() => {
const colors = ["red", "green", "blue"];
return (
<ul>
{colors.map((color) => (
<li key={color}>{color}</li>
))}
</ul>
);
});
Event click
Ember Octane
counter.hbs
<p>Counter: {{this.count}}</p>
<button {{on "click" this.incrementCount}}>+1</button>
counter.js
Qwik
Counter.tsx
import { component$, useSignal, $ } from "@builder.io/qwik";
export const Counter = component$(() => {
const count = useSignal(0);
const incrementCount = $(() => {
count.value++;
});
return (
<>
<p>Counter: {count.value}</p>
<button onClick$={incrementCount}>Increment</button>
</>
);
});
Dom ref
Ember Octane
input-focused.hbs
<input {{this.autofocus}} />
input-focused.js
Qwik
InputFocused.tsx
import { component$, useVisibleTask$, useSignal } from "@builder.io/qwik";
export const InputFocused = component$(() => {
const inputElement = useSignal<HTMLInputElement>();
useVisibleTask$(({ track }) => {
const el = track(inputElement);
el?.focus();
});
return <input type="text" ref={inputElement} />;
});
Conditional
Ember Octane
traffic-light.hbs
<button {{on "click" this.nextLight}}>Next light</button>
<p>Light is: {{this.light}}</p>
<p>
You must
{{#if (eq this.light "red")}}
STOP
{{else if (eq this.light "orange")}}
SLOW DOWN
{{else if (eq this.light "green")}}
GO
{{/if}}
</p>
traffic-light.js
Qwik
TrafficLight.tsx
import { $, component$, useComputed$, useSignal } from "@builder.io/qwik";
export const TRAFFIC_LIGHTS = ["red", "orange", "green"];
export const TrafficLight = component$(() => {
const lightIndex = useSignal(0);
const light = useComputed$(() => TRAFFIC_LIGHTS[lightIndex.value]);
const nextLight = $(() => {
lightIndex.value = (lightIndex.value + 1) % TRAFFIC_LIGHTS.length;
});
return (
<>
<button onClick$={nextLight}>Next light</button>
<p>Light is: {light.value}</p>
<p>
You must {light.value === "red" && <span>STOP</span>}
{light.value === "orange" && <span>SLOW DOWN</span>}
{light.value === "green" && <span>GO</span>}
</p>
</>
);
});
Lifecycle
On mount
Ember Octane
page-title.hbs
<p>Page title is: {{(this.pageTitle)}}</p>
page-title.js
Qwik
PageTitle.tsx
import { component$, useVisibleTask$, useStore } from "@builder.io/qwik";
export const App = component$(() => {
const store = useStore({
pageTitle: "",
});
useVisibleTask$(() => {
store.pageTitle = document.title;
});
return <p>Page title: {store.pageTitle}</p>;
});
On unmount
Ember Octane
time.hbs
<p>Current time: {{this.time}}</p>
time.js
Qwik
Time.tsx
import { component$, useVisibleTask$, useStore } from "@builder.io/qwik";
export const App = component$(() => {
const store = useStore({
time: new Date().toLocaleTimeString(),
});
useVisibleTask$(({ cleanup }) => {
const timer = setInterval(() => {
store.time = new Date().toLocaleTimeString();
}, 1000);
cleanup(() => clearInterval(timer));
});
return <p>Current time: {store.time}</p>;
});
Component composition
Props
Ember Octane
app.hbs
<UserProfile
@name="John"
@age={{20}}
@favouriteColors={{array "green" "blue" "red"}}
@isAvailable={{true}}
/>
user-profile.hbs
user-profile.js
Qwik
App.tsx
import { component$ } from "@builder.io/qwik";
import UserProfile from "./UserProfile";
const App = component$(() => {
return (
<UserProfile
name="John"
age={20}
favouriteColors={["green", "blue", "red"]}
isAvailable
/>
);
});
export default App;
Emit to parent
Ember Octane
app.hbs
<p>Are you happy?</p>
<AnswerButton @onYes={{this.handleYes}} @onNo={{this.handleNo}} />
<p style="font-size: 50px;">{{if this.isHappy "😀" "😥"}}</p>
app.js
answer-button.hbs
Qwik
App.tsx
import { $, component$, useStore } from "@builder.io/qwik";
import AnswerButton from "./AnswerButton";
const App = component$(() => {
const store = useStore({
isHappy: true,
});
const onAnswerNo = $(() => {
store.isHappy = false;
});
const onAnswerYes = $(() => {
store.isHappy = true;
});
return (
<>
<p>Are you happy?</p>
<AnswerButton onYes$={onAnswerYes} onNo$={onAnswerNo} />
<p style={{ fontSize: 50 }}>{store.isHappy ? "😀" : "😥"}</p>
</>
);
});
export default App;
Slot
Ember Octane
app.hbs
<FunnyButton> Click me! </FunnyButton>
funny-button.hbs
Qwik
App.tsx
import FunnyButton from "./FunnyButton";
export default function App() {
return <FunnyButton>Click me!</FunnyButton>;
}
Slot fallback
Ember Octane
app.hbs
<FunnyButton />
<FunnyButton>I got content!</FunnyButton>
funny-button.hbs
Qwik
App.tsx
import FunnyButton from "./FunnyButton";
export default function App() {
return (
<>
<FunnyButton />
<FunnyButton>Click me!</FunnyButton>
</>
);
}
Context
Ember Octane
app.hbs
<UserProfile />
user-profile.hbs
user-profile.js
user-service.js
Qwik
App.tsx
import {
component$,
useStore,
useContextProvider,
createContext,
$,
} from "@builder.io/qwik";
import UserProfile from "./UserProfile";
export const UserContext = createContext("user-context");
const App = component$(() => {
const user = useStore({
id: 1,
username: "unicorn42",
email: "unicorn42@example.com",
});
const updateUsername = $((newUsername) => {
user.username = newUsername;
});
useContextProvider(UserContext, { user, updateUsername });
return (
<>
<h1>Welcome back, {user.username}</h1>
<UserProfile />
</>
);
});
export default App;
Form input
Input text
Ember Octane
input-hello.hbs
<p>{{this.text}}</p>
<input value={{this.text}} {{on "input" this.handleInput}} />
input-hello.js
Qwik
InputHello.tsx
import { component$, useSignal } from "@builder.io/qwik";
const InputHello = component$(() => {
const text = useSignal("");
return (
<>
<p>{text.value}</p>
<input bind:value={text} />
</>
);
});
export default InputHello;
Checkbox
Ember Octane
is-available.hbs
<input
id="is-available"
type="checkbox"
checked={{this.isAvailable}}
{{on "change" this.handleChange}}
/>
<label for="is-available">Is available</label>
is-available.js
Qwik
IsAvailable.tsx
import { component$, useSignal } from "@builder.io/qwik";
const IsAvailable = component$(() => {
const isAvailable = useSignal(false);
return (
<>
<input id="is-available" type="checkbox" bind:checked={isAvailable} />
<label for="is-available">Is available</label>
</>
);
});
export default IsAvailable;
Radio
Ember Octane
pick-pill.hbs
<div>Picked: {{this.picked}}</div>
<input
id="blue-pill"
type="radio"
value="blue"
checked={{eq this.picked "blue"}}
{{on "change" this.handleChange}}
/>
<label htmlFor="blue-pill">Blue pill</label>
<input
id="red-pill"
type="radio"
value="red"
checked={{eq this.picked "red"}}
{{on "change" this.handleChange}}
/>
<label htmlFor="red-pill">Red pill</label>
pick-pill.js
Qwik
PickPill.tsx
import { component$, useSignal } from "@builder.io/qwik";
const PickPill = component$(() => {
const pickedColor = useSignal("red");
return (
<>
<div>Picked: {pickedColor.value}</div>
<input
id="blue-pill"
type="radio"
bind:value={pickedColor}
checked={pickedColor.value === "blue"}
value="blue"
/>
<label for="blue-pill">Blue pill</label>
<input
id="red-pill"
type="radio"
checked={pickedColor.value === "red"}
bind:value={pickedColor}
value="red"
/>
<label for="red-pill">Red pill</label>
</>
);
});
export default PickPill;
Select
Ember Octane
color-select.hbs
<select {{on "change" this.select}}>
{{#each this.colors as |color|}}
<option
value={{color.id}}
disabled={{color.isDisabled}}
selected={{eq color.id this.selectedColorId}}
>
{{color.text}}
</option>
{{/each}}
</select>
color-select.js
Qwik
ColorSelect.tsx
import { component$, useSignal } from "@builder.io/qwik";
export const colors = [
{ id: 1, text: "red" },
{ id: 2, text: "blue" },
{ id: 3, text: "green" },
{ id: 4, text: "gray", isDisabled: true },
];
const ColorSelect = component$(() => {
const selectedColorId = useSignal("2");
return (
<select bind:value={selectedColorId}>
{colors.map((color) => (
<option
key={color.id}
value={color.id}
disabled={color.isDisabled}
selected={`${color.id}` === selectedColorId.value}
>
{color.text}
</option>
))}
</select>
);
});
export default ColorSelect;
Webapp features
Render app
Ember Octane
Missing snippet
Qwik
index.html
<!DOCTYPE html>
<html>
<body>
<div id="app"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>
main.tsx
app.tsx
Fetch data
Ember Octane
app.hbs
{{#let (this.fetchUsers) as |request|}}
{{#if request.isLoading}}
<p>Fetching users...</p>
{{else if request.error}}
<p>An error occurred while fetching users</p>
{{else}}
<ul>
{{#each request.users as |user|}}
<li>
<img src={{user.picture.thumbnail}} alt="user" />
<p>{{user.name.first}} {{user.name.last}}</p>
</li>
{{/each}}
</ul>
{{/if}}
{{/let}}
app.js
Qwik
App.tsx
import { component$, useResource$, Resource } from "@builder.io/qwik";
type UsersResponse = {
results: {
picture: {
thumbnail: string;
};
name: {
first: string;
last: string;
};
}[];
};
export async function fetchUsers() {
return (await fetch("https://randomuser.me/api/?results=3")).json();
}
export const App = component$(() => {
const data = useResource$<UsersResponse>(fetchUsers);
return (
<Resource
value={data}
onPending={() => <p>Fetching users...</p>}
onRejected={() => <p>An error occurred while fetching users</p>}
onResolved={({ results: users }) => (
<ul>
{users.map((user) => (
<li>
<img src={user.picture.thumbnail} alt="user" />
<p>
{user.name.first} {user.name.last}
</p>
</li>
))}
</ul>
)}
/>
);
});
Decouvrez plus d’Offres de la plateform ItGalaxy.io :
Découvrez notre gamme complète de services et formations pour accélérer votre carrière.
1. Nous contactez
- Description: Besoin de Formation et des Solutions cloud complètes pour vos applications
- Links:
2. Infra as a Service
- Description: Infrastructure cloud évolutive et sécurisée
- Links:
3. Projets Développeurs
- Description: Découvrez des opportunités passionnantes pour les développeurs
- Links:
4. Développeurs
- Description: Rejoignez notre communauté de développeurs
- Links:
5. Formations Complètes
- Description: Accédez à des formations professionnelles de haute qualité
- Links:
6. Marketplace
- Description: Découvrez notre place de marché de services
- Links:
7. Blogs
- Description: Découvrez nos blogs
- Links:
- comment creer une application mobile ?
- Comment monitorer un site web ?
- Command Checkout in git ?
- Comment git checkout to commit ?
- supprimer une branche git
- dockercoin
- kubernetes c est quoi
- architecture kubernetes
- Installer Gitlab Runner ?
- .gitlab-ci.yml exemples
- CI/CD
- svelte 5 vs solid
- svelte vs lit
- solidjs vs qwik
- alpine vs vue
- Plateform Freelance 2025
- Creation d’un site Web gratuitement
This website is powered by ItGalaxy.io