tagu-tagu 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -354,7 +354,10 @@ document.body.appendChild(InitializerCallbackExample());
|
|
|
354
354
|
#### Animation
|
|
355
355
|
[`animate` initializer](./docs/animate.md)
|
|
356
356
|
|
|
357
|
-
### `
|
|
357
|
+
### `Signal`
|
|
358
|
+
|
|
359
|
+
#### `useState`
|
|
360
|
+
|
|
358
361
|
```typescript
|
|
359
362
|
import { button, div, useState } from "tagu-tagu";
|
|
360
363
|
|
|
@@ -372,6 +375,7 @@ document.body.appendChild(SimpleStateExample());
|
|
|
372
375
|
```
|
|
373
376
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/j3948zpo/1/)
|
|
374
377
|
|
|
378
|
+
#### `useComputed`
|
|
375
379
|
```typescript
|
|
376
380
|
import { button, div, useState, useComputed } from "tagu-tagu";
|
|
377
381
|
|
|
@@ -419,6 +423,32 @@ document.body.appendChild(TwoComputedSignalsStateExample());
|
|
|
419
423
|
```
|
|
420
424
|
[JSFiddle](https://jsfiddle.net/do_the_simplest/8hsuc5pn/5/)
|
|
421
425
|
|
|
426
|
+
#### `useEffect`
|
|
427
|
+
|
|
428
|
+
```typescript
|
|
429
|
+
import { button, div, useEffect, useState } from "tagu-tagu";
|
|
430
|
+
|
|
431
|
+
function EffectExample() {
|
|
432
|
+
const count = useState(0);
|
|
433
|
+
|
|
434
|
+
function incrementCount() {
|
|
435
|
+
count.set(count.get() + 1);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
useEffect(() => {
|
|
439
|
+
console.log("count:", count.get());
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
return div([
|
|
443
|
+
div("See console"),
|
|
444
|
+
button("+", { on: { click: incrementCount } }),
|
|
445
|
+
]);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
document.body.appendChild(EffectExample());
|
|
449
|
+
```
|
|
450
|
+
[JSFiddle](https://jsfiddle.net/do_the_simplest/ge3mbua4/3/)
|
|
451
|
+
|
|
422
452
|
### `If`
|
|
423
453
|
|
|
424
454
|
```typescript
|