You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revamps APIs to fix bugs and unlock a new suite of features.
6
+
7
+
```astro
8
+
<RootElement>
9
+
<button data-target="btn">Click me</button>
10
+
</RootElement>
11
+
12
+
<script>
13
+
RootElement.ready(($) => {
14
+
$('btn').addEventListener('click', () => {
15
+
console.log("It's like JQuery but not!");
16
+
});
17
+
});
18
+
</script>
19
+
```
20
+
21
+
- Support multiple instances of the same component. Before, only the first instance would become interactive.
22
+
- Enable data passing from the server to your client script using the `data` property.
23
+
- Add an `effect()` utility to interact with the [Signal polyfill](https://github.com/proposal-signals/signal-polyfill?tab=readme-ov-file#creating-a-simple-effect) for state management.
24
+
25
+
[Visit revamped documentation page](https://simple-stack.dev/query) to learn how to use the new features.
26
+
27
+
## Migration for v0.1
28
+
29
+
If you were an early adopter of v0.1, thank you! You'll a few small updates to use the new APIs:
30
+
31
+
- Wrap any HTML you want to target with the global `RootElement` component.
32
+
- Remove the `$` from your `data-target` selector (`data-target={$('btn')}` -> `data-target="btn"`). Scoping is now handled automatically.
33
+
- Change `$.ready()` to `RootElement.ready()`, and retrieve the `$` selector from the first function argument. The `$` selector is no longer a global.
34
+
35
+
```diff
36
+
+ <RootElement>
37
+
- <button data=target={$('btn')}>
38
+
+ <button data-target="btn">
39
+
Click me
40
+
</button>
41
+
+ </RootElement>
42
+
43
+
<script>
44
+
- $.ready(() => {
45
+
+ RootElement.ready(($) => {
46
+
$('btn').addEventListener('click', () => {
47
+
console.log("It's like JQuery but not!");
48
+
});
49
+
});
50
+
</script>
51
+
```
52
+
53
+
Since the syntax for `data-target` is now simpler, we have also **removed the VS Code snippets prompt.** We recommend deleting the snippets file created by v0.1: `.vscode/simple-query.code-snippets`.
0 commit comments