Skip to content

Commit

Permalink
Enhance getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdobler committed Jul 4, 2019
1 parent 73fc621 commit 3bdccc4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,36 @@ mount(document.querySelector("#my-view"),

For more complex views we suggest to add the [flyps-dom-snabbdom] extension, which adds support for [snabbdom] rendering.

### Snabbdom rendering

First install the extension: `npm i flyps-dom-snabbdom`

```
import { mount, h } from "flyps-dom-snabbdom";
mount(document.querySelector("#my-view"),
() => h("h1", "Hello World!")
);
```

### Render value from signal
```
import { signal } from "flyps";
import { mount, h } from "flyps-dom-snabbdom";
const data = signal("Hello World!");
mount(document.querySelector("#my-view"),
() => h("h1", data.value())
);
```

Whenever the `signal` is updated or replaced the view will be re-rendered with the new data.

```
data.reset("Hello User!");
```

### More Examples

More examples can be found on our flyps [homepage].
Expand Down

0 comments on commit 3bdccc4

Please sign in to comment.