-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes and improvements for some of Qwik examples (#233)
* Fix event click example for Qwik * Fix computed state example for Qwik * Fix update state example for Qwik * Fix declare state example for qwik * Fix conditional templating example for Qwik * Simplify input text example for Qwik * Simplify checkbox example for Qwik * Simplify select element example for Qwik * Simplify radio button example for Qwik
- Loading branch information
1 parent
5c50eec
commit 0a32b62
Showing
9 changed files
with
52 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { component$, useStore } from "@builder.io/qwik"; | ||
import { component$, useSignal } from "@builder.io/qwik"; | ||
|
||
export const Name = component$(() => { | ||
const store = useStore({ name: "John" }); | ||
const name = useSignal("John"); | ||
|
||
return <h1>Hello {store.name}</h1>; | ||
return <h1>Hello {name.value}</h1>; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { component$, useStore } from "@builder.io/qwik"; | ||
import { component$, useTask$, useSignal } from "@builder.io/qwik"; | ||
|
||
export const Name = component$(() => { | ||
const store = useStore({ name: "John" }); | ||
store.name = "Jane"; | ||
const name = useSignal("John"); | ||
|
||
return <h1>Hello {store.name}</h1>; | ||
useTask$(() => { | ||
name.value = "Jane"; | ||
}); | ||
|
||
return <h1>Hello {name.value}</h1>; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { component$, useStore } from "@builder.io/qwik"; | ||
import { component$, useSignal, useComputed$ } from "@builder.io/qwik"; | ||
|
||
export const DoubleCount = component$(() => { | ||
const store = useStore({ count: 10 }); | ||
const doubleCount = store.count * 2; | ||
const count = useSignal(10); | ||
const doubleCount = useComputed$(() => count.value * 2); | ||
|
||
return <div>{doubleCount}</div>; | ||
return <div>{doubleCount.value}</div>; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters